sas

SAS: lookup data inside a function/subroutine / return an array

左心房为你撑大大i 提交于 2020-01-14 03:10:10
问题 Suppose I like to do something like the following (with exemplary variable names for better readability): take a parameter InParameter and match it to the variable MyVar1 in a dataset MyData return all values for the variable MyVar2 for the filtered observations from a subroutine/function that i can use inside proc sql/datastep This is what I got so far (clearly not working): proc fcmp outlib=work.funcs.MyFunction; function MyFunction(InParameter $); array MyArray ... ; /* Here: Create an

Open SAS Program in new window

北战南征 提交于 2020-01-14 01:37:15
问题 Currently when you double click on a SAS file in windows, it will open it in an existing SAS session you already have open. Is there a way to make it so that when it is clicked in windows a new SAS window would start? 回答1: As far as I know SAS is a so called "single instance" application so it's default behaviour is to open it in an existing session. In fact you may notice that it gets opened in the first session you have opened. 回答2: I think this might be what you're looking for: How can I

R与SAS、SPSS之比较

眉间皱痕 提交于 2020-01-14 00:09:02
表:R与SAS、SPSS之比较 主题 SAS产品线 SPSS产品线 R语言相关包 高级模块 SAS/STAT® SPSS Advanced Models™ stat, MASS及众多扩展包 基础模块 SAS® SPSS Base™ R 联合分析 SAS/STAT®: Transreg SPSS Conjoint™ homals, psychoR , bayesm 对应分析 SAS/STAT®: Corresp SPSS Categories™ homals, MASS, FactoMineR ade4, PTAk, cocorresp, vegan, made4, PsychoR 自定义表格 SAS Base® Report、SQL, Tabulate SPSS Custom Tables™ reshape 数据接口 SAS/ACCESS® SPSS Data Access Pack™ DBI, foreign, RODBC 数据挖掘 Enterprise Miner™ Clementine® rattle, arules, FactoMineR 数据校验 Various procedures Various procedures, SPSS Data Preparation™ dprep, various functions Exact Tests SAS/STAT®:

R与SAS、SPSS之比较

我与影子孤独终老i 提交于 2020-01-13 07:51:04
表:R与SAS、SPSS之比较 主题 SAS产品线 SPSS产品线 R语言相关包 高级模块 SAS/STAT® SPSS Advanced Models™ stat, MASS及众多扩展包 基础模块 SAS® SPSS Base™ R 联合分析 SAS/STAT®: Transreg SPSS Conjoint™ homals, psychoR , bayesm 对应分析 SAS/STAT®: Corresp SPSS Categories™ homals, MASS, FactoMineR ade4, PTAk, cocorresp, vegan, made4, PsychoR 自定义表格 SAS Base® Report、SQL, Tabulate SPSS Custom Tables™ reshape 数据接口 SAS/ACCESS® SPSS Data Access Pack™ DBI, foreign, RODBC 数据挖掘 Enterprise Miner™ Clementine® rattle, arules, FactoMineR 数据校验 Various procedures Various procedures, SPSS Data Preparation™ dprep, various functions Exact Tests SAS/STAT®:

How do I invoke a sas script in python?

蓝咒 提交于 2020-01-13 05:33:29
问题 I can open a sas instance but im not certain how to get it to run a specific sas script. Im using the following code to start sas: import subprocess subprocess.call(['C:\Program Files\SAS\SASFoundation\9.2\sas.exe']) 回答1: You can pass additional parameters through to SAS via subprocess call, but the important things you also need to remember are: You need to tell SAS where to find the AUTOEXEC file You need to tell SAS where to find the config file I have a shell script that I use to invoke

Efficiently concatenate many sas datasets

蹲街弑〆低调 提交于 2020-01-13 04:18:45
问题 I have over 200k small datasets with the same variables (n<1000 and usually n<100) that I want to concatenate into a master dataset. I have tried using a macro that uses a data step to just iterate through all of the new datasets and concatenate with the master with "set master new:", but this is taking a really long time. Also, if I try to run at the same time, the call execute data step says that I am out of memory on a huge server box. For reference, all of the small datasets together are

How can I use Proc SQL to find all the records that only exist in one table but not the other?

五迷三道 提交于 2020-01-12 03:58:23
问题 I'm trying to do this in Enterprise Guide, with a task, otherwise I would just use a data step. In a data step, this would be: data names; input name $; datalines; John Mary Sally Fred Paul ; run; data check; input name $; datalines; Mary Fred ; Proc sort data=names; by name; run; Proc sort data=check; by name; run; Data work.not_in_check; merge names(in=n) check(in=c); by name; if n and not c; run; 回答1: Here's one way. There are surely many others. proc sql; create table not_in_check as

SAS proc SQL and arrays

时间秒杀一切 提交于 2020-01-11 11:35:39
问题 This is a newbie SAS question. I have a dataset with numerical variables v1-v120, V and a categorical variable Z(with say three possible values). For each possible value of Z , I would like to get another set of variables w1-w120, where w{i}=sum(v{i}}/V, where the sum is a sum over a given value of Z. Thus I am looking for 3*120 matrix in this case. I can do this in data step, but would like to do it by Proc SQL or Proc MEANS, as the number of categorical variables in the actual dataset is

SAS: PROC UNIVARIATE: Output trimmed mean to dataset

。_饼干妹妹 提交于 2020-01-11 11:29:09
问题 I'm doing the following the output the mean to a datset: PROC UNIVARIATE DATA=have trimmed=0.05; VAR age; by sex; output out=outputstats mean=theMean; run; proc print; run; How can I output the trimmed mean? I can't find the keyword to request so I can select it. 回答1: ODS OUTPUT to the rescue. Use ODS TRACE ON; to find the name. proc sort data=sashelp.class out=have; by sex; run; ods trace on; PROC UNIVARIATE DATA=have trimmed=0.05; VAR age; by sex; ods output TrimmedMeans=trimmedMeans; run;

Using do loops in R to create new variables

南楼画角 提交于 2020-01-10 04:30:03
问题 I'm a long time SAS programmer looking to make the jump to R. I know R isn't all that great for variable re-coding but is there a way to do this with do loops. If I have a lot of variables named a_1 a_2...a_100, b_1 b_2 ... b_100 and I want to create new variables c_1 c_2 ... c_100 where c_i = a_i + b_i. Is there a way to do this without 100 statements? In SAS I would simply use: %do i=1 %to 100; c_&i = a_&i + b_&i; %end; Thanks! 回答1: SAS uses a rudimentary macro language, which depends on