I am trying to match two groups. And I have a question about this statement.
what does this code mean?
data matched&n.; set matched&n._1-matched&n._&i.; proc sort data=matched&n.; by aID; run;
the bolded part!
Thank you so much!
Hi @HJ_ and welcome to the SAS Community 🙂
I'm guessing that the macro variables &n and &i confuses you. The code in cold simply means that the data step reads all the data sets matched&n._1 to matched&n._i. If &n=1 and &i=3, then that means that three data sets are read. Like below
%let n=1;
%let i=3;
data matched1_1;a=1;run;
data matched1_2;a=2;run;
data matched1_3;a=3;run;
data matched&n.;
set matched&n._1-matched&n._&i.;
run;
Hope this helps. Otherwise, feel free to ask.
Hi @HJ_ and welcome to the SAS Community 🙂
I'm guessing that the macro variables &n and &i confuses you. The code in cold simply means that the data step reads all the data sets matched&n._1 to matched&n._i. If &n=1 and &i=3, then that means that three data sets are read. Like below
%let n=1;
%let i=3;
data matched1_1;a=1;run;
data matched1_2;a=2;run;
data matched1_3;a=3;run;
data matched&n.;
set matched&n._1-matched&n._&i.;
run;
Hope this helps. Otherwise, feel free to ask.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.