sas 宏 call symput
问一下callsymput具体怎么用,我现在的大概是这个样子%MACROCREATDATA;%DOI=1%TO100;DATAFILE&I;DOID=1TO5;SCORE...
问一下call symput具体怎么用,我现在的大概是这个样子
%MACRO CREATDATA;
%DO I=1 %TO 100;
DATA FILE&I;
DO ID=1 TO 5;
SCORE=CEIL(100*RANUNI(&I));
END;
RUN;
pROC MEANS data=FILE&I MEAN;
RUN;
%END;
我下一步想用call symput 记录下来我算的mean,然后让我每一个data set里面的5个score和相对应data set算出来的mean相加,得到新的score。
另求高手帮助解决一下sas中 proc mixed等问题,qq聊 展开
%MACRO CREATDATA;
%DO I=1 %TO 100;
DATA FILE&I;
DO ID=1 TO 5;
SCORE=CEIL(100*RANUNI(&I));
END;
RUN;
pROC MEANS data=FILE&I MEAN;
RUN;
%END;
我下一步想用call symput 记录下来我算的mean,然后让我每一个data set里面的5个score和相对应data set算出来的mean相加,得到新的score。
另求高手帮助解决一下sas中 proc mixed等问题,qq聊 展开
展开全部
下面这段code应该可以解决你的问题
%MACRO CREATDATA;
%DO I=1 %TO 10;
DATA FILE&I.(drop=id);
DO ID=1 TO 5;
SCORE=CEIL(100*RANUNI(&I));
output;
END;
RUN;
pROC MEANS data=FILE&I ;
var score;
output out=outfile&i. mean=score_mean;
RUN;
data _null_;
set outfile&i.;
call symput( compress("score_mean"||"&i."), put(score_mean, 8.) );
run;
data out&i;
score=&&score_mean&i;
run;
data newscore&i;
set FILE&I. out&i. ;
run;
%END;
%mend;
%CREATDATA;
%MACRO CREATDATA;
%DO I=1 %TO 10;
DATA FILE&I.(drop=id);
DO ID=1 TO 5;
SCORE=CEIL(100*RANUNI(&I));
output;
END;
RUN;
pROC MEANS data=FILE&I ;
var score;
output out=outfile&i. mean=score_mean;
RUN;
data _null_;
set outfile&i.;
call symput( compress("score_mean"||"&i."), put(score_mean, 8.) );
run;
data out&i;
score=&&score_mean&i;
run;
data newscore&i;
set FILE&I. out&i. ;
run;
%END;
%mend;
%CREATDATA;
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询