<?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: Split data and pad with zero's in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360060#M84703</link>
    <description>&lt;P&gt;You can use the Z format to make an 11 character string with leading zeros and then add the hyphen.&lt;/P&gt;
&lt;P&gt;Or you could create a picture format. &amp;nbsp;With the picture format you could leave the variable as numeric if you wanted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
  picture id low-high='9999-9999999' other=' ';
run;

data text ;
  length x1 x2 8 c1 c2 $12;
  x1=3456789999 ;
  x2=x1;
  format x1 z11. x2 id. ;
  c1=put(x1,Z11.);
  c1=catx('-',substr(c1,1,4),substr(c1,5));
  c2=put(x1,id.);
  put (_all_) (=/);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 19 May 2017 17:37:25 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2017-05-19T17:37:25Z</dc:date>
    <item>
      <title>Split data and pad with zero's</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360048#M84697</link>
      <description>&lt;P&gt;Good Afternoon,&lt;/P&gt;&lt;P&gt;i need some insight please! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what im trying to do is, read a column that needs to be seperated.&lt;/P&gt;&lt;P&gt;the column reads&amp;nbsp; 3456789999&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i need to do is pad the first column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so i would split it in two clumns instr(columnA,4,7) to get 6789999&lt;/P&gt;&lt;P&gt;the 2nd column would need to be 0345 as the column needs to be 4 bytes.&lt;/P&gt;&lt;P&gt;and i want to concatenate the result&amp;nbsp; 0345-6789999&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 17:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360048#M84697</guid>
      <dc:creator>Bellefeuille</dc:creator>
      <dc:date>2017-05-19T17:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Split data and pad with zero's</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360052#M84698</link>
      <description>&lt;P&gt;Is the current column character or numeric?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 17:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360052#M84698</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-19T17:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Split data and pad with zero's</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360054#M84699</link>
      <description>&lt;P&gt;hi art,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the file im reading isnumeric,&lt;/P&gt;&lt;P&gt;end result as it has a dash, will need to be text which can have leading zero's&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 17:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360054#M84699</guid>
      <dc:creator>Bellefeuille</dc:creator>
      <dc:date>2017-05-19T17:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Split data and pad with zero's</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360057#M84700</link>
      <description>&lt;P&gt;Here is one way:&lt;/P&gt;
&lt;PRE&gt;data have;
  input columna;
  cards;
3456789999
;

data want;
  set have;
  columnb=substr(strip(put(columna,best32.)),4);
  columnc=substr(put(columna,z11.),1,3);
  columnd=catx('-',columnc,columnb);
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 17:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360057#M84700</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-19T17:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Split data and pad with zero's</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360058#M84701</link>
      <description>&lt;P&gt;hi art,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the file im reading is numeric,&lt;/P&gt;&lt;P&gt;end result as it has a dash, will need to be text which can have leading zero's&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 17:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360058#M84701</guid>
      <dc:creator>Bellefeuille</dc:creator>
      <dc:date>2017-05-19T17:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Split data and pad with zero's</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360060#M84703</link>
      <description>&lt;P&gt;You can use the Z format to make an 11 character string with leading zeros and then add the hyphen.&lt;/P&gt;
&lt;P&gt;Or you could create a picture format. &amp;nbsp;With the picture format you could leave the variable as numeric if you wanted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
  picture id low-high='9999-9999999' other=' ';
run;

data text ;
  length x1 x2 8 c1 c2 $12;
  x1=3456789999 ;
  x2=x1;
  format x1 z11. x2 id. ;
  c1=put(x1,Z11.);
  c1=catx('-',substr(c1,1,4),substr(c1,5));
  c2=put(x1,id.);
  put (_all_) (=/);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 May 2017 17:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-data-and-pad-with-zero-s/m-p/360060#M84703</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-19T17:37:25Z</dc:date>
    </item>
  </channel>
</rss>

