BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ronein
Meteorite | Level 14

Hello

I have an external input data set  with  varaible "YYMM" that includes in this example 4 rows.

The target is to create 4 parameters called: m1,m2,m3,m4.

parameter &m1  will recieve value of varaible "YYMM" in row 1.

parameter &m2  will recieve value of varaible "YYMM" in row 2.

parameter &m3  will recieve value of varaible "YYMM" in row 3.

parameter &m4  will recieve value of varaible "YYMM" in row 4.

I am trying to it but I don't receive the  requested result.

Please find the code.

thanks

Ron

DATA Raw_tbl;
INPUT YYMM;
CARDS;
1807
1806
1712
1707
;
RUN;


Data tbl2;
SET Raw_tbl;
VAR_NAME='m'||strip(_N_);
call symputx('VAR_NAME',VAR_NAME);
Run;

%put &m1; 
%put &m2; 
%put &m3; 
%put &m4; 
1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Just to be clear, what you are trying to create are macro variables, not parameters. Change your data step to

 

Data tbl2;
SET Raw_tbl;
VAR_NAME='m'||strip(_N_);
call symputx(VAR_NAME,YYMM);
Run;

View solution in original post

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

Just to be clear, what you are trying to create are macro variables, not parameters. Change your data step to

 

Data tbl2;
SET Raw_tbl;
VAR_NAME='m'||strip(_N_);
call symputx(VAR_NAME,YYMM);
Run;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 649 views
  • 1 like
  • 2 in conversation