Hello,
Quick question for you guys: I basically want to create a macro variable called syserr1 that if greater than 0 will give me an error message in an other code.
Now, the code below creates my macro variable no problem, I was just wondering if it was possible to create ONLY one macro variable in my procedure instead of 3? (AKA no need to create &nobs and &nuniqid
proc sql;
select count(distinct ID) as Nuniq, count(*) as Nobs, calculated Nobs - calculated Nuniq as diff
into :nobs, :nuniqid, :syserr1
from Have
;
quit;
Thank you
proc sql;
select count(*) - count(distinct ID) into :syserr1
from Have
;
quit;
I really don't understand your question. If you only want one macro variable, then only select one data item:
proc sql;
select count(distinct ID)
into :nobs
from Have;
quit;
proc sql;
select count(*) - count(distinct ID) into :syserr1
from Have
;
quit;
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 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.