Hello,
I have a program shown below. An error message was shown in the log window. Please help me to fix it. Thanks.
%Macro format_Repeater; data Repeater_Rochester_a; set Repeater_Rochester; %do k = 1 %to 5; CaseID_&k. = compress(CaseID_&k., "_-"); %end; put CaseID_&k.; run; %end; %mend; %format_Repeater;
The error message is list below.
You have two %END statements and only one %DO statement. And neither is in the right place.
If you keep the first one then you will reference the macro variable K after the end of he %DO loop. In that case its value will be 6.
If you keep the second one then you have included the RUN statement into the %DO loop and the statements generated by K=2 to 5 will be outside of the data step.
I am not sure what is going on, somehow I couldn't copy the error text here.
Error: There is no matching %DO statement for the %end. The statement will be ignored.
Never mind. I found out the issue. thank.
You have two %END statements and only one %DO statement. And neither is in the right place.
If you keep the first one then you will reference the macro variable K after the end of he %DO loop. In that case its value will be 6.
If you keep the second one then you have included the RUN statement into the %DO loop and the statements generated by K=2 to 5 will be outside of the data step.
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!
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.
Ready to level-up your skills? Choose your own adventure.