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;
CFC_SAS_Communities_400x225.jpg
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.