s********1 发帖数: 54 | 1 In the following code, I want to use "%put &status1" to show &status1=not.
But I did not see it in SAS log. Who can tell me why?
#######################################
data HIGHWAY;
input Steering $ Seatbelt $ Speed $ Status $ Count;
cards;
absent No 0-29 serious 31
absent No 0-29 not 1419
absent No 30-49 serious 191
absent no 30-49 not 2004
absent no 50+ serious 216
;
run;
%macro SPLIT;
proc sort data=HIGHWAY out=WORK.UNIQUES(keep=Status) nodupkey;
by Status;
run;
data fer;
set uniques end=Lastobs;
call symputx('Status'||left(_n_),Status);
%put &status1;
y=Lastobs;
if Lastobs then call symputx('Count',_n_);
run;
%local i;
data
%do i=1 %to &count;
&&Status&i
%end;
;
set HIGHWAY;
select(Status);
%do i=1 %to &Count;
when ("&&Status&i") output &&Status&i;
%end;
otherwise;
end;
run;
%mend;
%SPLIT | s*r 发帖数: 2757 | 2 难道现在不要双引号把macro var 包起来了 | x**********0 发帖数: 163 | 3 when you use the SYMPUT routine to create a macro variable in a data step,
the macro variable is not actually created and assigned a value until the
data step is executed. Therefore you can not reference a macro variable
within the same data step. just place the %put after the data step. |
|