o****o 发帖数: 8077 | 1 凑个热闹,给个比较冗长但是通用的解法
data test;
input id $1 v1 3 v2 $5-6 v3 8 v4 $10-11;
cards;
a 1 x2 .
a . 3
a . . x4
b 1 x2 .
b . 3
b . . x4
;
run;
proc sql noprint;
select
case
when(type='char') then cat('length ', compress(name), ' $ ',
length, ';')
else cat('length ', compress(name), ' ', length, ';')
end
into :varlist separated by ' '
from sashelp.vcolumn
where libname='WORK' and memname='TEST'
;
quit;
%put... 阅读全帖 |
|
g*******s 发帖数: 59 | 2 dataset ts; ts 包含dependent variable : orig_fl_bal_0,
independent variable: c1 c2 c3 c4
目的是实现proc model fit的自动化;
程序如下:
%let iv_list = c1 c2 c3 c4;
%global finalResult;
%global macrolist2;
%macro generateResults(varlist);
%let result = a&k.;
%let macrolist = a&k.;
%let k = %str(1);
%do %while(%scan(&varlist, (%sysevalf(&k))) ne );
%let iv = %scan(&varlist,(&sysevalf(&k)));
%let finalResult = &result + b&k.*&iv;
%let result = &finalResult;
%let macrolist2 = ¯olist b&k.;
%let macrolist = ¯ol... 阅读全帖 |
|
j**********3 发帖数: 305 | 3 这个用ods regions 的xy选项就可以实现啊!
example
ods layout start;
ods region x=0 in y=5.5 in height=4 in width=4 in;
%bar_chart(&dataIn, %scan(&varList,&i.,' '));
ods region x=4 in y=5.5 in height=4 in width=4 in;
%pie_chart(&dataIn, %scan(&varList,&i.,' '));
ods layout end; |
|
v*******e 发帖数: 133 | 4 工作当中遇到的,纠结了半天了
df1;
v1 v2 v3 v4.......v99 v100
df2;
Varlist1 Varlist 2
V1 V10
V2 V16
V5 V39
. .
. .
需要的是把df1里面存在于df2里Varlist1的variables的missing value用Varlist 2对应
的variable来置换
比较傻的做法,手工填写:
df1$V1=ifelse(is.na(df1$V1),df1$V10, df1$V1)
and so on...
可是df2有可能change dynamically.
如何来写这个loop. |
|
v*******e 发帖数: 133 | 5 工作当中遇到的,纠结了半天了
df1;
v1 v2 v3 v4.......v99 v100
df2;
Varlist1 Varlist 2
V1 V10
V2 V16
V5 V39
. .
. .
需要的是把df1里面存在于df2里Varlist1的variables的missing value用Varlist 2对应
的variable来置换
比较傻的做法,手工填写:
df1$V1=ifelse(is.na(df1$V1),df1$V10, df1$V1)
and so on...
可是df2有可能change dynamically.
如何来写这个loop. |
|
g**a 发帖数: 2129 | 6 varlist<-scan(file,what=character(),n=1) |
|
c**d 发帖数: 104 | 7 in the model: y = var1|var2|var3|var4 @2 /stepwise;
give you all 2-way interactions.
1. using proc contents output the variable name data
2: using proc sql to create a macro variable to paste your variables to be
var1|var2|var3|var4|.....
3: in the model y = &varlist. @2 /stepwise; |
|