SAS中文论坛

标题: Call Execute [打印本页]

作者: shiyiming    时间: 2005-10-23 14:04
标题: Call Execute
Foreword: Call execute is a function that can be used if you want to run some code based on the values of a dataset. In the example below the dataset test1 is only created if there is someone whose age = 100 in the dataset test:
[code:c445c]
data _null_;
set test;
if age=100 then do;
call execute("data test1;set test;run;");
stop;
end;
else stop;
run; [/code:c445c]

So in the example above the code that would be run if an age is =100 is:

[code:c445c]data _null_;
set test;
if age=100 then do;
call execute("data test1;set test;run;");
stop;
end;
else stop;
run;
data test1;
set test;
run; [/code:c445c]

Or a macro could be called:

[code:c445c]data _null_;
set test;
if age=100 then do;
call execute(%testmac);
stop;
end;
else stop;
run;[/code:c445c]




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2