Hello,
Currently I am trying to plug in the parameter midword and was wondering if anyone had any advice. I will attach the code below
%Let Num = 2 Proc SQL; Create Table Test as Select Name&NumFull, Year&NumLast From xx; Quit;
Ideally the columns that would be selected would be Name2Full and Year2Last.
Currently this is not working and it just trying to pull columns with the same exact names typed. I have tried " " and ' ' around them and it does not work. Any advice would be much appreciated.
Try this instead.
This is a classic example of when to use the dot (.) de delimit macro variables. In your code, SAS looks for the macro variables &NumFull and &NumLast in the symbol tables. You want SAS to look for the macro variable &Num 🙂
%Let Num = 2
Proc SQL;
Create Table Test as
Select Name&Num.Full,
Year&Num.Last
From xx;
Quit;
Try this instead.
This is a classic example of when to use the dot (.) de delimit macro variables. In your code, SAS looks for the macro variables &NumFull and &NumLast in the symbol tables. You want SAS to look for the macro variable &Num 🙂
%Let Num = 2
Proc SQL;
Create Table Test as
Select Name&Num.Full,
Year&Num.Last
From xx;
Quit;
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.