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

 

Wondering if some can help, please?

 

I am trying to create a decoded variable for any list of variables with the code below.

The code below is creating the variables but also throwing some warnings in the log, would it be possible to remove these warnings.

For example, var1=agegrp and var1dc should be agegrpdc.

I have to keep %let statvar statement, as it will be one of the parameters for a macro variable where i add more variables.

 

 

%macro dothis;

%let statvr=agegrp gender ;

%do i = 1 %to %sysfunc(countw(&statvr));

%let seq&i. = %scan(&statvr,&i,%str( ));

%let a=dc;

%let s=%str();

%let seqdc&i.=%sysfunc(catx(&s,&seq&i,%nrstr(%superq(a))));

%let var1 = %scan(&statvr,&i,%str( ));

%end;

%mend;

%dothis;

WARNING: Apparent symbolic reference SEQ not resolved.

WARNING: Apparent symbolic reference SEQ not resolved.

WARNING: Apparent symbolic reference SEQ not resolved.

WARNING: Apparent symbolic reference SEQ not resolved.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

a quick look tells me 

%let seqdc&i.=%sysfunc(catx(&s,&seq&i,%nrstr(%superq(a))));

 

&seq&i  is incorrect and you need to refer with double &&seq&i 

 

plus you don't need concat functions in macro language for the most part

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20

a quick look tells me 

%let seqdc&i.=%sysfunc(catx(&s,&seq&i,%nrstr(%superq(a))));

 

&seq&i  is incorrect and you need to refer with double &&seq&i 

 

plus you don't need concat functions in macro language for the most part

Sami1234
Fluorite | Level 6

Thanks allot, its working fine now 🙂

Sami1234
Fluorite | Level 6

Wondering if some can help, please?

 

I am trying to create a decoded variable for any list of variables with the code below.

The code below is creating the variables but also throwing some warnings in the log, would it be possible to remove these warnings.

For example, var1=agegrp and var1dc should be agegrpdc.

I have to keep %let statvar statement, as it will be one of the parameters for a macro variable where i add more variables.

 

 

%macro dothis;

%let statvr=agegrp gender ;

%do i = 1 %to %sysfunc(countw(&statvr));

%let seq&i. = %scan(&statvr,&i,%str( ));

%let a=dc;

%let s=%str();

%let seqdc&i.=%sysfunc(catx(&s,&seq&i,%nrstr(%superq(a))));

%let var1 = %scan(&statvr,&i,%str( ));

%end;

%mend;

%dothis;

WARNING: Apparent symbolic reference SEQ not resolved.

WARNING: Apparent symbolic reference SEQ not resolved.

WARNING: Apparent symbolic reference SEQ not resolved.

WARNING: Apparent symbolic reference SEQ not resolved.

 

 

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 523 views
  • 2 likes
  • 2 in conversation