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( ));
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.