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?
What version of SAS do you have? This type of syntax is valid in SAS 9.3+
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.
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.
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.
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.