<?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 strings in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848887#M335627</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Your DO loop replaces REV_STRING with a single character each time through the loop ... not what is needed.&amp;nbsp; Do you need help in fixing that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about blanks?&amp;nbsp; For example, this code contains 7 trailing blanks in STRING:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length string $ 10;
string = 'ABC';
rev_string = reverse(string);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Using the REVERSE function, the result would contain 7 leading blanks followed by "CBA".&amp;nbsp; Are you attempting to replicate that result, or are you intending to ignore the blanks and get "CBA" followed by 7 trailing blanks?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Either of the "problems" caused by spaces in the REVERSE function are easy to fix. Easier than writing your own code.&lt;/P&gt;</description>
    <pubDate>Sat, 10 Dec 2022 13:13:34 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-12-10T13:13:34Z</dc:date>
    <item>
      <title>reverse strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848872#M335614</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nnn;
set sashelp.class;
length rev_string $ 25;
do i=1 to length(rev_string);
rev_string=substr(Name,length(Name)-i,1);
end;drop i ;
proc print;run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;how reverse string (Name) where i did wrong in the class dataset&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 11:31:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848872#M335614</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-12-10T11:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: reverse strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848873#M335615</link>
      <description>&lt;P&gt;Is this an assignment? Otherwise, why not use the Reverse Function?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 11:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848873#M335615</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-12-10T11:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: reverse strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848875#M335617</link>
      <description>&lt;P&gt;The DO loop you wrote is incorrect. To reverse a string, you can use the SAS function REVERSE(). You can use it, like this:&lt;BR /&gt;rev_string = reverse(Name);&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 11:43:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848875#M335617</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2022-12-10T11:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: reverse strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848877#M335619</link>
      <description>&lt;P&gt;Yes Peter&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am trying instead of REVERSE function&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 11:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848877#M335619</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-12-10T11:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: reverse strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848878#M335620</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes Peter&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I am trying instead of REVERSE function&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why write your own code instead of the REVERSE function?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 11:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848878#M335620</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-10T11:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: reverse strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848886#M335626</link>
      <description>&lt;P&gt;Your DO loop replaces REV_STRING with a single character each time through the loop ... not what is needed.&amp;nbsp; Do you need help in fixing that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about blanks?&amp;nbsp; For example, this code contains 7 trailing blanks in STRING:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length string $ 10;
string = 'ABC';
rev_string = reverse(string);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Using the REVERSE function, the result would contain 7 leading blanks followed by "CBA".&amp;nbsp; Are you attempting to replicate that result, or are you intending to ignore the blanks and get "CBA" followed by 7 trailing blanks?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 13:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848886#M335626</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-12-10T13:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: reverse strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848887#M335627</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Your DO loop replaces REV_STRING with a single character each time through the loop ... not what is needed.&amp;nbsp; Do you need help in fixing that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about blanks?&amp;nbsp; For example, this code contains 7 trailing blanks in STRING:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length string $ 10;
string = 'ABC';
rev_string = reverse(string);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Using the REVERSE function, the result would contain 7 leading blanks followed by "CBA".&amp;nbsp; Are you attempting to replicate that result, or are you intending to ignore the blanks and get "CBA" followed by 7 trailing blanks?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Either of the "problems" caused by spaces in the REVERSE function are easy to fix. Easier than writing your own code.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 13:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848887#M335627</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-10T13:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: reverse strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848890#M335628</link>
      <description>You're absolutely right, the REVERSE function would be easier and more accurate.  I'm assuming that this is a homework assignment and the instructor is trying to make that exact point:  functions are thoroughly tested and debugged and easier to use when compared to "do it yourself" code.</description>
      <pubDate>Sat, 10 Dec 2022 14:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848890#M335628</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-12-10T14:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: reverse strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848925#M335640</link>
      <description>&lt;P&gt;Use two index variables: one to count down from length(name) to 1, the other starting at 1 and incrementing in the loop. Then use SUBSTR on the left and right side of the assignment (left for rev_string, right for name).&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 19:30:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848925#M335640</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-10T19:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: reverse strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848928#M335642</link>
      <description>&lt;P&gt;Also, an&amp;nbsp;opportunity to use the rarely used character format&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/leforinforref/1.0/p0ti0qkwdebezvn1jp7z10rcdblc.htm" target="_self"&gt;$REVERS Format&lt;/A&gt; .&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 19:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reverse-strings/m-p/848928#M335642</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-12-10T19:45:38Z</dc:date>
    </item>
  </channel>
</rss>

