options symbolgen;
%macro mac01(data=prac.mac01);
data _NULL_;
set &data(keep=Make);
%local first_make;
%IF _N_ = 1 %THEN %DO;
&first_make = Make;
call symput("First", &first_make);
%END;
%put &First;
run;
proc print data=&data(firstobs=1 obs=5 keep=Make) noobs;
run;
%mend mac01;
%scoreit(program=mac01)
options nosymbolgen; 139 options symbolgen;
140 %macro mac01(data=prac.mac01);
141 data _NULL_;
142 set &data(keep=Make);
143 %local first_make;
144 %IF _N_ = 1 %THEN %DO;
145 &first_make = Make
146 call symput("First", &first_make);
147 %END;
148 %put &First;
149 run;
150
151 proc print data=&data(firstobs=1 obs=5 keep=Make) noobs;
152 run;
153 %mend mac01;
154
155 %scoreit(program=mac01)
SYMBOLGEN: Macro variable PROGRAM resolves to mac01
SYMBOLGEN: Macro variable DATA resolves to prac.mac01
WARNING: Apparent symbolic reference FIRST not resolved.
&First
NOTE: There were 428 observations read from the data set PRAC.MAC01.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
SYMBOLGEN: Macro variable DATA resolves to prac.mac01
NOTE: There were 5 observations read from the data set PRAC.MAC01.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.05 seconds
cpu time 0.06 seconds
156 options nosymbolgen;
157
158
159 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
171 I cannot resolve the First macro variable, can anyone help me with that? The data is from sashelp.cars and the task is to write a macro to extract the first make value which is character.
... View more