@alparle wrote:
thanks, it works with " |" as delimiter but i could not find the define comma as delimiter.
So if you use " |" as the delimiter in a %SCAN() call that means that it should treat any of the three characters double quote, space or vertical bar as a possible delimiter.
If you want to use comma as the delimiter then you need to use macro quoting (or actual quoting) to make sure the commas do not get seen by SAS as argument delimiters instead of as part of the string.
Macro quoting:
%let alparle = NCEPA7,NCEPA8;
proc sql;
create table levo as
select ALT, %scan(%quote(&alparle),1,%str(,))
from work.datahave
;
quit;
Actual quote characters.
%let alparle = NCEPA7,NCEPA8;
proc sql;
create table levo as
select ALT, %scan("&alparle",1,",")
from work.datahave
;
quit;
The only added value of throwing space in as an additional delimiter characters is eliminates any spaces that might exist around the actual delimiters.
Example:
48 %let list= A , B;
49 %put |%scan("&list",1,",")|;
|A |
50 %put |%scan("&list",1," ,")|;
|A|
... View more