Hi!
I want to go through the elements of a list but there is a dot in the name of the elements of the list and there it separates the elements of the list I only want to separate them along the spaces.
%macro px;
%let value = x.yy a.yy;
%local i next_value;
%let i=1;
%do %while (%scan(&value, &i) ne );
%let next_value = %scan(&value, &i);
%put &next_value;
%let i = %eval(&i + 1);
%end;
%mend;
%px;I get this :
You have to specifically tell the SCAN function to only use spaces as word delimiter, and not spaces plus periods plus other special symbols (which is the default). Modify these two lines as shown
%do %while (%scan(&value, &i) ne %str( ));
%let next_value = %scan(&value, &i, %str( ));
You have to specifically tell the SCAN function to only use spaces as word delimiter, and not spaces plus periods plus other special symbols (which is the default). Modify these two lines as shown
%do %while (%scan(&value, &i) ne %str( ));
%let next_value = %scan(&value, &i, %str( ));
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!
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.