Hello,
When I put the following Macro statments in a loop in Macro program, it gave me error , however, I can run by itself without probelm. I I am wondering what is the problem.
Thank you.
%let medlist = %str("cisplatin" ; "carboplatin"; "paclitaxel" ; "paclitaxel protein-bound" ; "pemetrexed disodium"; "ramucirumab"; "bevacizumab" ; "pembrolizumab" ; "nivolumab" ; "necitumumab" );
%let med = %scan(&medlist, 8 , ; );
%macro test1;
%let medlist = %str("cisplatin" ; "carboplatin"; "paclitaxel" ; "paclitaxel protein-bound" ; "pemetrexed disodium"; "ramucirumab"; "bevacizumab" ; "pembrolizumab" ; "nivolumab" ; "necitumumab" );
%do i =1 %to 10 ;
%let med = %scan(&medlist, &i , ; );
%put &med ;
%end;
%mend;
%test1;
NOTE: One or more missing close parentheses have been supplied for the %SCAN function.
Put the ; delimiter into a %str() function so it doesn't get interpreted as end of command indicator.
%let med = %scan(&medlist, &i , %str(;) );
What error do you get?
NOTE: One or more missing close parentheses have been supplied for the %SCAN function.
Put the ; delimiter into a %str() function so it doesn't get interpreted as end of command indicator.
%let med = %scan(&medlist, &i , %str(;) );
%let med = %scan(&medlist, &i , %str(;) );
The "bare" semicolon is treated as a statement ender. I would consider use of a ; as a delimiter a poor choice for working with SAS code. Is there a specific reason you used that?
Dear all,
Thank you very much,
%str() works so beautifully ! 🙂
Ivy
Then please mark one of the answers as correct answer
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.