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( ));
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.