<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reverse a string without using REVERSE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reverse-a-string-without-using-REVERSE/m-p/873586#M345177</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;you can do that for fun, I currently see 2 ways.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 03 May 2023 11:10:05 GMT</pubDate>
    <dc:creator>Oligolas</dc:creator>
    <dc:date>2023-05-03T11:10:05Z</dc:date>
    <item>
      <title>Reverse a string without using REVERSE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reverse-a-string-without-using-REVERSE/m-p/873580#M345172</link>
      <description>&lt;P&gt;hi, can you help me to reverse a string without using REVERSE function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;String 'i just want to play a Game'&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 10:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reverse-a-string-without-using-REVERSE/m-p/873580#M345172</guid>
      <dc:creator>kindbe17</dc:creator>
      <dc:date>2023-05-03T10:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string without using REVERSE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reverse-a-string-without-using-REVERSE/m-p/873581#M345173</link>
      <description>&lt;P&gt;Why would you want to avoid using the exact function that does EXACTLY what you want?&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 10:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reverse-a-string-without-using-REVERSE/m-p/873581#M345173</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-03T10:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string without using REVERSE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reverse-a-string-without-using-REVERSE/m-p/873586#M345177</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;you can do that for fun, I currently see 2 ways.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 May 2023 11:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reverse-a-string-without-using-REVERSE/m-p/873586#M345177</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2023-05-03T11:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse a string without using REVERSE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reverse-a-string-without-using-REVERSE/m-p/873588#M345178</link>
      <description>&lt;P&gt;This program does it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;%let str = %str(i just want to play a Game);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;%let len = %length(&amp;amp;str);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data _null_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; length str_in str_out $ &amp;amp;len;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; str_in = "&amp;amp;str";&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; do i = 1 to &amp;amp;len;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; substr(str_out, i, 1) = substr(str_in, &amp;amp;len + 1 - i, 1);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; end;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; put str_in= str_out=;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 11:23:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reverse-a-string-without-using-REVERSE/m-p/873588#M345178</guid>
      <dc:creator>drdivago</dc:creator>
      <dc:date>2023-05-03T11:23:50Z</dc:date>
    </item>
  </channel>
</rss>

