p***r 发帖数: 920 | 1 purpose: 想要做一个macro 循环调用 display, 输出不同的 survey answer as text,
然 后再根据其内容,人工的输入yes/no,以便于以后的数据分析。
problem: 整个 macro 可以运行,唯一的问题是,display 的 window 在循环调用的时
候不能正确的显示 survey answer. (我是将所有的 survey answer 输出到一连串
macro variable 里面去)。
Any solution or suggestion in proving the code is appreciated
code is here
################################
data surveydata;
input x $40.;
cards;
This is programe is useless
I dont think so
Maybe its usefull
Not very much
;run;
%macro survey;
data _null_;
set surveydata end=eof;
call symput('var'||compress(_n_),x);
if eof then call symput('var_n',compress(_n_));
run;
%put &var1 &var2 &var3 &var_n;
%put step1;
%let mask=%bquote(&var);
****************************************
Defining the windows,This
is where the problems came. I guess*****
***************************************;
%window askit
#10 @12 "the content is &mask"
#13 @12 getdata 3 attr=underline
#16 @12 "Press ENTER to continue."
;
**************************************
Call the windows, everything seems okay.
**************************************;
%do i=1 %to &var_n;
%put var&i = &&var&i;
%let getdata=;
%display askit;
%put &i = &getdata;
%let B&i=;
%if %upcase(&getdata)=YES %then %let B&i=1;
%if %upcase(&getdata)=NO %then %let B&i=0;
%end;
%put step3;
%put B1=&B1 B2=&B2 B3=&B3 B4=&B4 N=&var_n;
%mend; | p***r 发帖数: 920 | | f*****k 发帖数: 110 | 3 How? Could you please show your solution so that we green hands can learn.
Thanks a lot!
【在 p***r 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 自己解决了,谢谢~
| p***r 发帖数: 920 | 4 just put the %windows statement in the iteration, and make some adjustment.
then everything is fine. I think this has things to do with the macro
facility and the scope of macro variable.
【在 f*****k 的大作中提到】![](/moin_static193/solenoid/img/up.png) : How? Could you please show your solution so that we green hands can learn. : Thanks a lot!
| f*****k 发帖数: 110 | 5 还是不懂,惭愧。
.
【在 p***r 的大作中提到】![](/moin_static193/solenoid/img/up.png) : just put the %windows statement in the iteration, and make some adjustment. : then everything is fine. I think this has things to do with the macro : facility and the scope of macro variable.
|
|