BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ppinedo
Obsidian | Level 7

Hi everyone,

I'm getting crazy to find out the error. Can anybody help me??

ppinedo_0-1717582952275.png

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

You have omitted the % sign:  %do %until, not %do until

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

How about this:

 

proc means data=mc1.storm_final n mean max maxdec=0;
    class season;
    var maxwindmph minpressure;
run;

 

 

So, my solution is to not use a %DO loop or any macro language at all.

 

From now on, please post code as text in the box that appears when you click on the "little running man" icon and please post logs as text in the box that appears when you click on the </> icon. DO NOT POST LOGS AND CODE AS SCREEN CAPTURES.

--
Paige Miller
ppinedo
Obsidian | Level 7

ok about the image @PaigeMiller

 

using your solution, same error continues:

77         %macro storms(list);
 78         %local i;
 79         %let i=1;
 80         %do until(%scan(&list,&i) eq );
 ERROR: An unexpected semicolon occurred in the %DO statement.
 ERROR: A dummy macro will be compiled.
 81         %let n=%scan(&list,&i);
 82         title "&n Storms";
 83         proc means data=mc1.storm_final n min mean max maxdec=0;
 84         class season;
 85             var MaxWindMPH MinPressure;
 86             where season=&n;
 87         run;
 88         %let i=%sysevalf(&i + 1);
 89         %end;
 90         %mend storms;
 91         
 92         %storms(2011 2014)
            _
            180
 WARNING: Apparent invocation of macro STORMS not resolved.
 ERROR 180-322: Statement is not valid or it is used out of proper order.
 

message error is about %do until loop, no about proc means.

PaigeMiller
Diamond | Level 26

You have completely misunderstood. My solution does not use any macro %DO loops, it does not use any macro language at all. It uses  PROC MEANS with a CLASS statement, that's all you need.

--
Paige Miller
ppinedo
Obsidian | Level 7

I'm studying %do while/until loops, I need to use loops (your solution is valid but it not use loops)

 

PaigeMiller
Diamond | Level 26

@ppinedo wrote:

I'm studying %do while/until loops, I need to use loops (your solution is valid but it not use loops)

 


I would say that the idea of learning macros is good, but you also need to learn when NOT to use macros. I would never want to see someone write a macro to do that same thing as a SAS PROC.

--
Paige Miller
Astounding
PROC Star

You have omitted the % sign:  %do %until, not %do until

ppinedo
Obsidian | Level 7

you're right @Astounding  ¡¡¡, newbie "silly" mistake 🙄

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 7 replies
  • 589 views
  • 3 likes
  • 3 in conversation