BookmarkSubscribeRSS Feed
bnsmithjr
Calcite | Level 5

What if the %LET = a column name, but it doesn't define a specific row of dat? What value does it receive?
I'm not a SAS programmer, just trying to read it and convert it to SQL. The routine creates a table of values and does this:
PROC SORT DATA=CURNSN&cnt; BY IINSGM; RUN;
%LET newcol&cnt=IAC_&Q._&NUDCYCLE;
%LET nicd&cnt=NEWITMCD_&Q._&NUDCYCLE;
I have the &cnt value, the &Q value and the &NUDCYCLE value. Both LET values correspond to a column. Which row will provide the value? I'm guessing the last, or possibly the first?

3 REPLIES 3
PaigeMiller
Diamond | Level 26

It's not clear what you are trying to do. Please explain further what you are trying to do.

 

Macro variables are just text strings. In the first statement, if suppose &CNT = 2, for example, you are creating a macro variable named NEWCOL2 which has some value ... the value depends on the value of &Q and &NUDCYCLE, but it is a text string, and this macro variable value is unrelated to any particular data set or value within a data set. The value of &NEWCOL2 is simply a text string, outside of a data set.

--
Paige Miller
ErikLund_Jensen
Rhodochrosite | Level 12

Hi @Florent 

The discussion forum SAS Macro Facility, Data Step and SAS Language Elements sounds interesting, but I haven't been able to find it anywhere in communities.sas.com. May I ask for directions to get there?

 

thanks

Rick_SAS
SAS Super FREQ

That forum existed in 2009, when this thread was started, but it has been merged into the SAS Programming community.

 

I understand that you are a new community member, so welcome! Here's a tip: Rather than add to a thread from 12 years ago, I encourage you to create a new thread for your question. You can link to the old post, if you think it has relevant information.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 794 views
  • 1 like
  • 4 in conversation