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

Folks,

 

I'm getting the following error 180-322 when I'm running this Macro. From reading online it appears the most logical reason is that I'm missing a semi colon. however, from looking at my code I can't seem to see what the error is.

 

So I'm creating a new dataset which stacks two datasets on top of each other and then aggregates two variables to create a new variable. 

 

It appears to do it, but I get this every year. 

 

Any help would be most welcome.

 

%macro survey;
%do year = 2011 %to 2015;
data combine_&year.;
set mywork.combined_sample_&year._5 survey18plus_&year.;
totalincome=sum(of nat_totinc_admin_personal,indoincome);
Dispinc=sum(of nat_dispinc_admin_personal,indodisp);
run;

%end;


%mend;
%survey (2011);
%survey (2012);
%survey (2013);
%survey (2014);
%survey (2015);
36         %survey (2014);
                   _
                   180
ERROR 180-322: Statement is not valid or it is used out of proper order.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

The macro is built to process all 5 years.  Just call it once and stop trying to tell the macro what year to use:

 

%survey

View solution in original post

2 REPLIES 2
Astounding
PROC Star

The macro is built to process all 5 years.  Just call it once and stop trying to tell the macro what year to use:

 

%survey

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Compare the macro signature:

%macro survey;

With the way you are calling it:

%survey (2011);

 There is a difference.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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