data _null_;
put "First method:";
string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; * string from A to Z;
do i=1 to length(string);
char = substrn(string, i, 1);
put char=;
end;
put "Second method (using RANK and BYTE):";
do i=rank('A') to rank('Z');
char = byte(i);
put char=;
end;
run;
If you can find any way better, please let me know.
Friday, November 29, 2019
How to loop character A-Z in SAS?
To loop characters A-Z elegantly, we can have two ways as follows:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment