BookmarkSubscribeRSS Feed
LuisMijares
Calcite | Level 5
I removed the * end; but I'm still getting the same error.
PaigeMiller
Diamond | Level 26

Have you tried re-starting SAS and then running the code again?

--
Paige Miller
Stu_SAS
SAS Employee

Hey @LuisMijares! Take a look at this set of lines here:

 

    ****************************************************************************************************
    /* Alzhimers diagnosis*

    /*Assign 1 to ALZH_MEDPAR for matches in alzhimers_codes;

 

While the DATA Step can read and compile this correctly, the macro processor is unable to determine where the comment starts and stops. As a result, it's getting confused and causing an issue where things are commented out that are not expected. To resolve this, change these lines to the following:

 

    /****************************************************************************************************/
    /* Alzhimers diagnosis */

    /*Assign 1 to ALZH_MEDPAR for matches in alzhimers_codes */

 

This will allow the code to run correctly in a macro. As a best practice, you should use /* */ for commenting rather than *; especially when using macros, as it is the safest to use per SAS KB0036213. I would recommend going through your code and removing any *; comments and replacing them with /* */

Tom
Super User Tom
Super User

Why do you not end the data step inside the macro?

Tom_0-1736357426242.png

What statements did you submit after the macro call?

Perhaps that is where the extra END statement is being added to the last data step generated by the macro.

LuisMijares
Calcite | Level 5
the %medpar_analysis is part of a larger program I'm applying to the medpar_2019-2021 datasets, the previous loop compiled without error

run;
%end;
%medn medpar_analysis;
%medpar_analysis;

correct?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 19 replies
  • 2452 views
  • 3 likes
  • 5 in conversation