I want to parse a macro value with text, spaces and slashes separated by comma delimiters. I got the code for the second %PUT statement from https://communities.sas.com/t5/SAS-Programming/How-to-scan-comma-delimited-macro-variable-list/td-p/...
However, I'm getting an error message. How can I rectify?
27 %put &sel_ing4;
DROSPIRENONE / ETHINYL ESTRADIOL / LEVOMEFOLATE CALCIUM, ETHINYL ESTRADIOL / ETHYNODIOL DIACETATE, ETHINYL ESTRADIOL /
LEVONORGESTREL, ETHINYL ESTRADIOL / NORETHINDRONE, ETHINYL ESTRADIOL / NORETHINDRONE ACETATE
28 %put %scan(%superQ(&Sel_Ing4),1,%str(,));
ERROR: Invalid symbolic variable name DROSPIRENONE ETHINYL ESTRADIOL / LEVOMEFOLATE CALCIUM, ETHINYL ESTRADIOL / ETHYNODIOL
DIACETATE, ETHINYL ESTRADIOL / LEVONORGESTREL, ETHINYL ESTRADIOL / NORETHINDRONE, ETHINYL ESTRADIOL / NORETHINDRONE ACETATE.
%put %scan(%superQ(&Sel_Ing4),1,%str(,));
I think you need %bquote and not %superq
%put %scan(%superQ(&Sel_Ing4),1,%str(,));
I think you need %bquote and not %superq
No, the delimiter is actually a comma. This is a list of active ingredient groups for the same drugs and the producer of the original data chose to join them with slashes. It originally came in a single variable in the following format (just showing two cells).
DROSPIRENONE / ETHINYL ESTRADIOL / LEVOMEFOLATE CALCIUM
ETHINYL ESTRADIOL / NORGESTIMATE
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.