Hello,
I'm curious if I could create a do loop (1-6) in the following programming.
%macro LotNum(sourcedate,sourcetype,sourceLogN);
%let i=(&rr + 1);
%let rr=%eval(&i);
proc sql;
create table Pathgen&rr as
select site,id,&sourcetype,&sourcedate,&sourceLogN
from Pathgen
where &sourcedate. ^=. and &sourcedate. ^= '08aug8888'd and &sourcetype. in (1,2,3) and sourceLogN = ''
order by site,id;
%let Pathgen_&rr=%str(LotNumumber are blank);
ods proclabel "check &rr:&&&Pathgen_&rr";
data Pathgen&rr;
length var1 $250;
set Pathgen&rr;
var1="&sourcedate.="||trim(left(put(&sourcedate.,mmddyy10.)))||','||
"&sourcetype.="||trim(left(put(&sourcetype.,3.)))||','||
"&sourceLogN.="||trim(left(put(&sourceLogN.,$10.)));
run;
%createPathgen;
%mend LotNum;
%LotNum(Pathgendt1,Pathgentype1,Pathgenlot1);
%LotNum(Pathgendt2,Pathgentype2,Pathgenlot2);
%LotNum(Pathgendt3,Pathgentype3,Pathgenlot3);
%LotNum(Pathgendt4,Pathgentype4,Pathgenlot4);
%LotNum(Pathgendt5,Pathgentype5,Pathgenlot5);
%LotNum(Pathgendt6,Pathgentype6,Pathgenlot6);
%macro doloop;
%do i=1 to 6;
%LotNum(Pathgendt&i,Pathgentype&i,Pathgenlot&i)
%end;
%mend;
%doloop
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.