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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.