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

Hi ,

I have an issue with a macro variable.  When i run it for first time, it runs fine ... in the 2nd run when i change the input year, it still retains the value from previous run. although i do see taht the correct row is fetched (since I have not mentioned noprint its displaying the result.)   but the log shows the macro is still retaining a year from the prev run..

PROC SQL ;
SELECT TRIM(MAX(NAME)) into :Max_date
FROM DICTIONARY.COLUMNS
WHERE LIBNAME='WORK' AND MEMNAME = 'ADDT_LOOKUP'
AND substr(NAME,1,5) = "D&YEAR.";
QUIT;
1 ACCEPTED SOLUTION

Accepted Solutions
Smijoss
Fluorite | Level 6

Hi Reeza,

Thank you for your response.   I have found the reason.

Earlier i was using the call execute which was causing this issue.

DATA _NULL_ ;

       Set MSAFrmt.regions_list ;

       call execute('%FETCH_RECORDS('||Orgnm||")");

Run;


Now instead of using the sas data step if i directly call the macro   %FETCH_RECORDS(co)  it does not give this issue.


Thanks again.

Smiley Happy

View solution in original post

3 REPLIES 3
Smijoss
Fluorite | Level 6

I have tried using  %symdel and then recreate it but it does not work  Smiley Sad

Reeza
Super User

Post your full log with the %put statements between each call.

Use option mprint and symbolgen to see what is occurring.

Smijoss
Fluorite | Level 6

Hi Reeza,

Thank you for your response.   I have found the reason.

Earlier i was using the call execute which was causing this issue.

DATA _NULL_ ;

       Set MSAFrmt.regions_list ;

       call execute('%FETCH_RECORDS('||Orgnm||")");

Run;


Now instead of using the sas data step if i directly call the macro   %FETCH_RECORDS(co)  it does not give this issue.


Thanks again.

Smiley Happy

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
  • 3 replies
  • 964 views
  • 0 likes
  • 2 in conversation