<?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: Reading substrings by means of SCAN or alternative in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-substrings-by-means-of-SCAN-or-alternative/m-p/131291#M1797</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I was able to do it using substr and translate. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 May 2013 13:08:53 GMT</pubDate>
    <dc:creator>TurnTheBacon</dc:creator>
    <dc:date>2013-05-08T13:08:53Z</dc:date>
    <item>
      <title>Reading substrings by means of SCAN or alternative</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-substrings-by-means-of-SCAN-or-alternative/m-p/131288#M1794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Imagine that you have a folder with the following reports:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Commissions GW 0413 Ohio&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Commissions GW 0413 Indiana&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Commissions GW 0413 Minnesota&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Commissions GW 0413 Illinois&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Commissions GW 0413 Pennsylvania&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Commissions GW 0413 Colorado&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You want SAS to read the file names starting from "GW", and you want to turn the spaces into underscores. So, when read into SAS, the strings should look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reportname&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;GW_0413_Ohio&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;GW_0413_Indiana&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;GW_0413_Minnesota&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;GW_0413_Illinois&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;GW_0413_Pennsylvania&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;GW_0413_Colorado&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this can be done by means of the SCAN function, but I can't seem to make it work. I'd appreciate any advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your time. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 08:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-substrings-by-means-of-SCAN-or-alternative/m-p/131288#M1794</guid>
      <dc:creator>TurnTheBacon</dc:creator>
      <dc:date>2013-05-07T08:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Reading substrings by means of SCAN or alternative</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-substrings-by-means-of-SCAN-or-alternative/m-p/131289#M1795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A combination of call scan/indexw and translate should do the trick.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 08:56:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-substrings-by-means-of-SCAN-or-alternative/m-p/131289#M1795</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-05-07T08:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Reading substrings by means of SCAN or alternative</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-substrings-by-means-of-SCAN-or-alternative/m-p/131290#M1796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;Maybe this could work:&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;new_string = translate(trim(prxchange("s/.*Commissions //", -1, string)), "_", "");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;prxchange : will replace/change everything up to (including) the word &lt;EM&gt;Commissions&lt;/EM&gt; with a blank space;&lt;/P&gt;&lt;P&gt;trim : will remove the trailing blanks (so you don't attach an underscore at the end of the string;&lt;/P&gt;&lt;P&gt;translate : will replace any blanks with underscore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anca.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 11:27:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-substrings-by-means-of-SCAN-or-alternative/m-p/131290#M1796</guid>
      <dc:creator>AncaTilea</dc:creator>
      <dc:date>2013-05-07T11:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reading substrings by means of SCAN or alternative</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-substrings-by-means-of-SCAN-or-alternative/m-p/131291#M1797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I was able to do it using substr and translate. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 May 2013 13:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-substrings-by-means-of-SCAN-or-alternative/m-p/131291#M1797</guid>
      <dc:creator>TurnTheBacon</dc:creator>
      <dc:date>2013-05-08T13:08:53Z</dc:date>
    </item>
  </channel>
</rss>

