<?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 Length and Truncation in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148098#M39166</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;I Have dataset with numerical id as variable. I would like to write a code in a such way that i get red colored below out put.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;40047915 -------Truncate 40 if it starts with 40 and the length is 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;40047916&lt;/P&gt;&lt;P&gt;40047917&lt;/P&gt;&lt;P&gt;400032724&lt;/P&gt;&lt;P&gt;400032725&lt;/P&gt;&lt;P&gt;400032726---------- Truncate 400 if it starts with 400 and the length is 9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;047915&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;047916&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;047917&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;032724&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;032725&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;032726&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jun 2014 12:19:13 GMT</pubDate>
    <dc:creator>rakeshvvv</dc:creator>
    <dc:date>2014-06-19T12:19:13Z</dc:date>
    <item>
      <title>Length and Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148098#M39166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;I Have dataset with numerical id as variable. I would like to write a code in a such way that i get red colored below out put.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;40047915 -------Truncate 40 if it starts with 40 and the length is 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;40047916&lt;/P&gt;&lt;P&gt;40047917&lt;/P&gt;&lt;P&gt;400032724&lt;/P&gt;&lt;P&gt;400032725&lt;/P&gt;&lt;P&gt;400032726---------- Truncate 400 if it starts with 400 and the length is 9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;047915&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;047916&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;047917&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;032724&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;032725&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: red;"&gt;032726&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 12:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148098#M39166</guid>
      <dc:creator>rakeshvvv</dc:creator>
      <dc:date>2014-06-19T12:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Length and Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148099#M39167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if substr(thevariable,1,2)="40" and length(strip(thevariable))=8 then substr(thevariable,3);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if substr(thevariable,1,3)="400" and length(strip(thevariable))=9 then substr(thevariable,4);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should be aware though your logic seems to overlap as 400 appears for each record.&amp;nbsp; So only the length check is really necessary, i.e. if length(strip(thevariable))=8 then substr(2..), else sustr(3...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just thought also, you could also reverse the string and take the first 8 characters, then reverse again.&amp;nbsp; Or you could also right() the string, take the last 8 characters and then left e.g&amp;nbsp; substr(right(thevariable),length(right(thevariable)-8);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 12:27:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148099#M39167</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-06-19T12:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Length and Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148100#M39168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it is a number then you can use the MOD() function to get the least significant digits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;want = mod(nid,10**6) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But of course if it is numeric there is no way to store the leading zeros in your examples.&amp;nbsp; You could apply the Z format to have the numbers print with leading zeros.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 12:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148100#M39168</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-06-19T12:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Length and Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148101#M39169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the rule can be interpreted as "regardless of the length of the variable, keep the last 6 digits", then the following can also do:&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; var &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newvar=prxchange(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'s/.*(\d{6})$/$1/'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,trim(var));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;40047915 &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;40047916&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;40047917&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;400032724&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;400032725&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;400032726&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 12:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148101#M39169</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-06-19T12:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Length and Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148102#M39170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code below will handle a numeric starting value.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data have;&lt;BR /&gt;&amp;nbsp; input&amp;nbsp; value $9.; &lt;BR /&gt;&amp;nbsp; length wantval 8; format wantval z6.;&lt;BR /&gt;if length(value) = 8 then wantval = input(substr(value,3,6),8.) ;&lt;BR /&gt;if length(value) = 9 then wantval = input(substr(value,4,6),8.) ;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;40047915&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;40047916&lt;BR /&gt;40047917&lt;BR /&gt;400032724&lt;BR /&gt;400032725&lt;BR /&gt;400032726&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=have;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works if your original input value has to remain as a number.&amp;nbsp; The length function only works on character variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;&amp;nbsp; input&amp;nbsp; value 9. valuec $9.; &lt;BR /&gt;&amp;nbsp; length wantval 8; format wantval z6.;&lt;BR /&gt;valuec = put(value,9.);&lt;BR /&gt;if length(valuec) = 8 then wantval = input(substr(valuec,3,6),8.) ;&lt;BR /&gt;if length(valuec) = 9 then wantval = input(substr(valuec,4,6),8.) ;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;40047915&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;40047916&lt;BR /&gt;40047917&lt;BR /&gt;400032724&lt;BR /&gt;400032725&lt;BR /&gt;400032726&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=have;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: James Willis&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 12:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148102#M39170</guid>
      <dc:creator>jwillis</dc:creator>
      <dc:date>2014-06-19T12:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Length and Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148103#M39171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This also works.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data work.have;&lt;BR /&gt;&amp;nbsp; input&amp;nbsp; value 9.;&lt;BR /&gt;&amp;nbsp; format wantval z6.; &lt;BR /&gt;&amp;nbsp; valclen = length(strip(put(value,9.)));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if valclen = 8 then wantval = value - 40000000;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if valclen = 9 then wantval = value - 400000000;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;40047915&lt;BR /&gt;40047916&lt;BR /&gt;40047917&lt;BR /&gt;400032724&lt;BR /&gt;400032725&lt;BR /&gt;400032726&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 13:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148103#M39171</guid>
      <dc:creator>jwillis</dc:creator>
      <dc:date>2014-06-19T13:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Length and Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148104#M39172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply......is there way that i can take take only last 6 numbers if the barcode starts with 4.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;400032735--------032735&lt;/P&gt;&lt;P&gt;400032736-------032736&lt;/P&gt;&lt;P&gt;400032737-------032737&lt;/P&gt;&lt;P&gt;40046812--------046812&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 13:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148104#M39172</guid>
      <dc:creator>rakeshvvv</dc:creator>
      <dc:date>2014-06-19T13:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Length and Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148105#M39173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did not test this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;&amp;nbsp; input&amp;nbsp; value 9.; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length wantval 8; format wantval z6.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wantval = substr((put(value,9.)),(length(put(value,9.)) - 6),6);&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;40047915&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;40047916&lt;BR /&gt;40047917&lt;BR /&gt;400032724&lt;BR /&gt;400032725&lt;BR /&gt;400032726&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did test this and this works:&lt;/P&gt;&lt;P&gt;proc sql; drop table work.have; quit;&lt;BR /&gt;data have;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&amp;nbsp; value 9.; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length wantval&amp;nbsp; 8 ; format wantval&amp;nbsp; z6.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if substr(strip(put(value,9.)),1,1) = '4' then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wantval = substr((strip(put(value,9.))),((length(strip(put(value,9.))) - 6) + 1),6);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; datalines;&lt;BR /&gt;40047915&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;40047916&lt;BR /&gt;40047917&lt;BR /&gt;400032724&lt;BR /&gt;400032725&lt;BR /&gt;400032726&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;proc print data=work.have;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: James Willis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 13:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148105#M39173</guid>
      <dc:creator>jwillis</dc:creator>
      <dc:date>2014-06-19T13:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Length and Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148106#M39174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input id $ 9.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;40047915&lt;/P&gt;&lt;P&gt;40047916&lt;/P&gt;&lt;P&gt;40047917&lt;/P&gt;&lt;P&gt;400032724&lt;/P&gt;&lt;P&gt;400032725&lt;/P&gt;&lt;P&gt;400032726&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;id_new=catt('0',mod(id,100000));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 14:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148106#M39174</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-06-19T14:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Length and Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148107#M39175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is a simple way using base SAS functions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data ids;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile cards;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input long_id 9.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id = reverse(substr(reverse(put(long_id,9.)),1,6));&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;40047915&lt;/P&gt;&lt;P&gt;40047916&lt;/P&gt;&lt;P&gt;40047917&lt;/P&gt;&lt;P&gt;400032724&lt;/P&gt;&lt;P&gt;400032725&lt;/P&gt;&lt;P&gt;400032726&lt;/P&gt;&lt;P&gt;;;;;&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 15:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-and-Truncation/m-p/148107#M39175</guid>
      <dc:creator>Wizard</dc:creator>
      <dc:date>2014-06-19T15:22:28Z</dc:date>
    </item>
  </channel>
</rss>

