you can do that for fun, I currently see 2 ways.
data test; length string $50; string='i just want to play a Game '; run; *use the $reversw. format; data want; set test; string2=put(string,$REVERS32767.); run; *Build your reverse string char by char starting from the end; data want; set test; length string2 $50; retain string2; string2=''; j=0; do i=lengthn(string) to 1 by -1; j+1; string2=substrn(string2,1,j)||substrn(string,i,1); put string2=; end; run;
- Cheers -
This program does it:
%let str = %str(i just want to play a Game);
%let len = %length(&str);
length str_in str_out $ &len;
str_in = "&str";
do i = 1 to &len;
substr(str_out, i, 1) = substr(str_in, &len + 1 - i, 1);
put str_in= str_out=;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.