<?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: Trim Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602051#M174262</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
Order_Number='12345678912,';
run;

proc sql;
    create table want as
    select Order_Number length=11
    from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 06 Nov 2019 16:13:37 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-11-06T16:13:37Z</dc:date>
    <item>
      <title>Trim Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602044#M174258</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a variable (Order_Number) which typically has 11 numbers, in some instances, it has a ',' or a text after. Is there anyway to remove anything after the 11th Number please?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 16:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602044#M174258</guid>
      <dc:creator>KC_16</dc:creator>
      <dc:date>2019-11-06T16:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602045#M174259</link>
      <description>&lt;P&gt;You say "typically", are the values you want ever shorter than 11?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in a data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;string = substr(string,1,11);&lt;/P&gt;
&lt;P&gt;will remove anything passed the 11th character.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 16:02:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602045#M174259</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-06T16:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602046#M174260</link>
      <description>&lt;P&gt;I would simply set an appropriate length like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    length Order_Number $11;
    Order_Number='12345678912,';
    put Order_Number=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Order_Number=12345678912&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Nov 2019 16:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602046#M174260</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-06T16:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602050#M174261</link>
      <description>&lt;P&gt;Thanks for this, how would I do this using PROC SQL? I have 2 parts of inherited code so I need the logic in a Data step (thank you) and the same logic in a PROC SQL if possible please?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 16:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602050#M174261</guid>
      <dc:creator>KC_16</dc:creator>
      <dc:date>2019-11-06T16:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602051#M174262</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
Order_Number='12345678912,';
run;

proc sql;
    create table want as
    select Order_Number length=11
    from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Nov 2019 16:13:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trim-Variable/m-p/602051#M174262</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-06T16:13:37Z</dc:date>
    </item>
  </channel>
</rss>

