proc sql noprint;
select distinct strip(VARIABLE) into :commonrs separated by ', ' ,
distinct strip(VARIABLE) into :commonvrg separated by ' '
from COMMON;
quit;
I am using the above code, just to make sure before sending test data as i get syntax error, can anyone help me figure out where the issue was.
distinct strip(VARIABLE) into :commonvarsmrg separated by ' ' from COMMON;
--------
79
76
ERROR 79-322: Expecting a :.
ERROR 76-322: Syntax error, statement will be ignored.
You can only use DISTINCT once, it applies to all variables.
Also,
select distinct strip(VARIABLE1),strip(VARIABLE2)
into :commonrs separated by ', ' ,:commonvrg separated by ' '
from COMMON;
You can only use DISTINCT once, it applies to all variables.
Also,
select distinct strip(VARIABLE1),strip(VARIABLE2)
into :commonrs separated by ', ' ,:commonvrg separated by ' '
from COMMON;
Hi @vraj1
Select and into are separate statements, each with a variable list, so the correct syntax should be:
proc sql noprint;
select distinct
strip(VARIABLE),
strip(VARIABLE)
into
:commonrs separated by ', ' ,
:commonvrg separated by ' '
from COMMON;
quit;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.