<?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: substr command in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/substr-command/m-p/127800#M34951</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Patrick, I'm still a novice to SAS, I'll take your advice in running parts of the code each time.&amp;nbsp; Made the correction and it worked fine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;input A B $ @@;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;123 ABCD&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a; set a ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if substr(B,1,1) = "A" then type ="S";&lt;/P&gt;&lt;P&gt;else type='K';&lt;/P&gt;&lt;P&gt;T = substr(B,1,2);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 06 Jul 2013 01:18:04 GMT</pubDate>
    <dc:creator>steppermotor</dc:creator>
    <dc:date>2013-07-06T01:18:04Z</dc:date>
    <item>
      <title>substr command</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substr-command/m-p/127798#M34949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello I am just trying to figure out a simple substr command:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;input A B @@;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;123 ABCD&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a; set a ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if substr(B,1,1) = "A" then type ="S";&lt;/P&gt;&lt;P&gt;else type='K';&lt;/P&gt;&lt;P&gt;T = substr(B,1,2);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure why this code is not working, it just always defaults to K. Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jul 2013 01:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substr-command/m-p/127798#M34949</guid>
      <dc:creator>steppermotor</dc:creator>
      <dc:date>2013-07-06T01:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: substr command</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substr-command/m-p/127799#M34950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Run the first data step only and then check what you've actually got in table 'a'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also: Always read the SAS log as it gives you valuable information, eg:&lt;/P&gt;&lt;P&gt;NOTE: Invalid data for B in line 18 5-8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jul 2013 01:12:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substr-command/m-p/127799#M34950</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-07-06T01:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: substr command</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/substr-command/m-p/127800#M34951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Patrick, I'm still a novice to SAS, I'll take your advice in running parts of the code each time.&amp;nbsp; Made the correction and it worked fine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;input A B $ @@;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;123 ABCD&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a; set a ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if substr(B,1,1) = "A" then type ="S";&lt;/P&gt;&lt;P&gt;else type='K';&lt;/P&gt;&lt;P&gt;T = substr(B,1,2);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jul 2013 01:18:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/substr-command/m-p/127800#M34951</guid>
      <dc:creator>steppermotor</dc:creator>
      <dc:date>2013-07-06T01:18:04Z</dc:date>
    </item>
  </channel>
</rss>

