<?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 function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/361896#M85428</link>
    <description>&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Post test data in the form of a datastep!!&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So am just guessing that is a character string here:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  result_var=ifc(lengthn(original_var)=13,".",original_var);
run;&lt;/PRE&gt;
&lt;P&gt;Why would you want the resulting character string to be '.' anyways, that is for numeric data.&lt;/P&gt;</description>
    <pubDate>Fri, 26 May 2017 08:09:16 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-05-26T08:09:16Z</dc:date>
    <item>
      <title>substr function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/361854#M85400</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the table that has the column name as "ID". If the ID has 13 characters&amp;nbsp;then it has to be blank. Below are some examples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;000709-W34&lt;BR /&gt;000709-W36&lt;BR /&gt;000709-W39&lt;BR /&gt;002028980-001&lt;BR /&gt;002028980-002&lt;BR /&gt;002028980-003&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Output should be as below:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;000709-W34&lt;BR /&gt;000709-W36&lt;BR /&gt;000709-W39&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2017 04:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/361854#M85400</guid>
      <dc:creator>cho16</dc:creator>
      <dc:date>2017-05-26T04:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: substr function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/361858#M85403</link>
      <description>&lt;P&gt;I think you want the LENGTH and CALL MISSING functions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use length to check the length of the string and call missing to set it to missing, if desired.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: Substr takes a portion of string, I'm not sure how your subject line relates to your question.&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/73714"&gt;@cho16&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the table that has the column name as "ID". If the ID has 13 characters&amp;nbsp;then it has to be blank. Below are some examples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;000709-W34&lt;BR /&gt;000709-W36&lt;BR /&gt;000709-W39&lt;BR /&gt;002028980-001&lt;BR /&gt;002028980-002&lt;BR /&gt;002028980-003&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Output should be as below:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;000709-W34&lt;BR /&gt;000709-W36&lt;BR /&gt;000709-W39&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in Advance&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2017 04:23:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/361858#M85403</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-26T04:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: substr function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/361896#M85428</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Post test data in the form of a datastep!!&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So am just guessing that is a character string here:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  result_var=ifc(lengthn(original_var)=13,".",original_var);
run;&lt;/PRE&gt;
&lt;P&gt;Why would you want the resulting character string to be '.' anyways, that is for numeric data.&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2017 08:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/361896#M85428</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-26T08:09:16Z</dc:date>
    </item>
  </channel>
</rss>

