<?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: substring in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617885#M181140</link>
    <description>&lt;P&gt;It would help to see a portion of the actual data of variable ColumnOne. Otherwise, how could we be sure what the problem is? We also need to see the YEAR variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please follow these instructions to create SAS data step code for your data, please provide a portion of your data this way and not via any other method:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, a lot more information is needed here.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2020 19:34:35 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-01-16T19:34:35Z</dc:date>
    <item>
      <title>substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617882#M181139</link>
      <description>&lt;P&gt;&lt;FONT&gt;I want to give a filter on columnOne in the where clause&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;I use the following code in SQL and I get what i want &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;but when I write the same code in proc sql there is no errors but my code is not returning any rows?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;Please help!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;where year =2019&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;and right(left(ColumnOne, 6), 2) = 'DB'&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 19:18:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617882#M181139</guid>
      <dc:creator>USHAKS</dc:creator>
      <dc:date>2020-01-16T19:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617885#M181140</link>
      <description>&lt;P&gt;It would help to see a portion of the actual data of variable ColumnOne. Otherwise, how could we be sure what the problem is? We also need to see the YEAR variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please follow these instructions to create SAS data step code for your data, please provide a portion of your data this way and not via any other method:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, a lot more information is needed here.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 19:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617885#M181140</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-16T19:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617892#M181142</link>
      <description>&lt;P&gt;&lt;FONT&gt;Thanks for the help&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;CHEMDB&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;MATHDBGS&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 19:29:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617892#M181142</guid>
      <dc:creator>USHAKS</dc:creator>
      <dc:date>2020-01-16T19:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617900#M181144</link>
      <description>&lt;P&gt;Not sure what you are trying to do here but the LEFT and RIGHT functions in SAS only have one parameter, not two as in your example:&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=ds2ref&amp;amp;docsetTarget=n1j1jxao7prdsmn1f9hrjtkwc6ue.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;https://documentation.sas.com/?docsetId=ds2ref&amp;amp;docsetTarget=n1j1jxao7prdsmn1f9hrjtkwc6ue.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe - substr(ColumnOne, 5, 2) = 'DB';&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 19:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617900#M181144</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-01-16T19:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617904#M181146</link>
      <description>&lt;P&gt;We also need to see YEAR.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show this to us as a SAS data step, following these isntructions:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or perhaps show us the output of PROC CONTENTS, that will give us a clue.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 19:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617904#M181146</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-16T19:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617907#M181148</link>
      <description>&lt;P&gt;Are you just trying to test if the value end with the letters DB?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where year =2019
  and ColumnOne like '%DB'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you really had a need to extract the last two characters from a string then use the function mentioned in your subject line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have ;
  last2 = substrn(ColumnOne,length(ColumnOne)-1));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 19:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617907#M181148</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-16T19:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617936#M181165</link>
      <description>&lt;P&gt;&lt;FONT&gt;in the where clause this script worked.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;AND( substr(ColumnOne,5,2) ='DB' OR &lt;FONT&gt;ColumnOne&lt;/FONT&gt; like '%DB' )&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 21:26:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substring/m-p/617936#M181165</guid>
      <dc:creator>USHAKS</dc:creator>
      <dc:date>2020-01-16T21:26:13Z</dc:date>
    </item>
  </channel>
</rss>

