Hello
I have a macro varible whose value can be like this
%let x='a''b';
%letx='ab''bc';
%letx='a''b''c';
what I want is have spaces between words
my output should be
1st one ='a' 'b'
2nd one='ab' 'bc'
3rd one ='a' 'b' 'c'
how can i achieve this
And you still want it in a macro variable?
not really
what my aim is that I want to extract each word and then apply scan function
for example in this case
%let x='a''b'
once i get the value as 'a' 'b' the i can easily apply scan function and extact 'a' and 'b' separately
you can extract from within the macro variable as well as below
%let x=%sysfunc(scan('a''b',2,''));
%put &x;
Please try as below
%let x=%sysfunc(tranwrd('a''b','',' '));
%put &x;
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.