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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.