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

Not sure why this code has the errors, could not find out why :

 

%macro dellob(lobname,lobdate);

PROC SQL;

delete * from reworko.rework&lobname_sumamry

WHERE MONTH=&lobdate;

QUIT;

%mend dellob;

%dellob(0500,'2017-07');

 

Error message:

delete * from reworko.rework&lobname_sumamry WHERE MONTH=&lobdate; QUIT;

_

22

200

WARNING: Apparent symbolic reference LOBNAME_SUMAMRY not resolved.

ERROR 22-322: Syntax error, expecting one of the following: a name, ;, (, AS, WHERE.

ERROR 200-322: The symbol is not recognized and will be ignored.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

Try:

%macro dellob(lobname,lobdate);
PROC SQL;
delete * from reworko.rework&lobname._sumamry
WHERE MONTH=&lobdate;
QUIT;
%mend dellob;
%dellob(0500,'2017-07');
 

see message in log:

    WARNING: Apparent symbolic reference LOBNAME_SUMAMRY not resolved.

Your macro variable is LOBNAME so you need a dot to assing end of macro variable name.

 

View solution in original post

3 REPLIES 3
Shmuel
Garnet | Level 18

Try:

%macro dellob(lobname,lobdate);
PROC SQL;
delete * from reworko.rework&lobname._sumamry
WHERE MONTH=&lobdate;
QUIT;
%mend dellob;
%dellob(0500,'2017-07');
 

see message in log:

    WARNING: Apparent symbolic reference LOBNAME_SUMAMRY not resolved.

Your macro variable is LOBNAME so you need a dot to assing end of macro variable name.

 

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

works now... thank you

PaigeMiller
Diamond | Level 26

The proper syntax for the PROC SQL DELETE statement is:

 

DELETE FROM tablename ...

 

http://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=sqlproc&docsetTarget=n0wvt1t0e...

--
Paige Miller

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!

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.

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