BookmarkSubscribeRSS Feed
Lopa2016
Fluorite | Level 6

I am trying to use the set statement for multiple datasets in one shot namely I have datasets vmoreranked1,vmoreranked2,vmoreranked3,...But constantly getting an error

 data stackorig;
set vmoreranked1-vmoreranked&vmcnt; run;
                  -
                  22

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, ;, END, KEY, KEYS, NOBS, OPEN, POINT, DATA, LAST, NULL.

NOTE: The SAS System stopped processing this step because of errors.

Can someone help?

4 REPLIES 4
Reeza
Super User

What version of SAS do you have? This type of syntax is valid in SAS 9.3+

SASKiwi
Opal | Level 21

This may be caused by &vmcnt not resolving correctly. Check by replacing this with a number like 2 just to see if it fixes the problem.

Astounding
Opal | Level 21

My guess:  &VMCNT was created by PROC SQL and thus includes leading blanks.  The easiest way to overcome this is to add this statement before the DATA step:

 

%let vmcnt = &vmcnt;

 

Alternatively (depending on how much subsequent processing has taken place), you might be able to use &SQLOBS instead of &VMCNT.

Jagadishkatam
Amethyst | Level 16
I agree with @Astounding, may be there are leading blank spaces in the macro variable vmcnt, so try to use %cmpres function which will remove the blank if any.

data stackorig;
set vmoreranked1-vmoreranked%cmpres(&vmcnt);
run;
Thanks,
Jag

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 869 views
  • 3 likes
  • 5 in conversation