<?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: How to format a list of zip codes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/932923#M366969</link>
    <description>&lt;P&gt;If it is not easy to design such a format, you can use character functions:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ip $42.; 
  cards;
985051536
65132022
217718034
;
run;

data want;
  set have;
  new_ip=ifc(length(ip)&amp;lt;9,'0',trimn(''))||ip;
  new_ip=substr(new_ip,1,5)||'-'||substr(new_ip,6);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 19 Jun 2024 03:39:07 GMT</pubDate>
    <dc:creator>whymath</dc:creator>
    <dc:date>2024-06-19T03:39:07Z</dc:date>
    <item>
      <title>How to format a list of zip codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/932916#M366965</link>
      <description>&lt;P&gt;I have a long list of zip codes that is a string of unformatted numeric numbers. I need to format them with a hyphen (re: zip+4) and if the zip only has 5 digits, I need a 0 in front it as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;obs&amp;nbsp; &amp;nbsp; &amp;nbsp; zip&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;985051536&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 65132022&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;217718034&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want:&lt;/P&gt;
&lt;P&gt;obs&amp;nbsp; &amp;nbsp; &amp;nbsp; zip&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;98505-1536&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 06513-2022&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;21771-8034&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 23:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/932916#M366965</guid>
      <dc:creator>ChickenLittle</dc:creator>
      <dc:date>2024-06-18T23:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a list of zip codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/932922#M366968</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input obs      zip : $20.;
cards;
1           985051536
2          65132022
3           217718034
;

proc format;
picture fmt
low-high='99999-9999'
;
run;
data want;
 set have;
 want=input(zip,best32.);
 format want fmt.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jun 2024 03:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/932922#M366968</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-06-19T03:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a list of zip codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/932923#M366969</link>
      <description>&lt;P&gt;If it is not easy to design such a format, you can use character functions:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ip $42.; 
  cards;
985051536
65132022
217718034
;
run;

data want;
  set have;
  new_ip=ifc(length(ip)&amp;lt;9,'0',trimn(''))||ip;
  new_ip=substr(new_ip,1,5)||'-'||substr(new_ip,6);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jun 2024 03:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/932923#M366969</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2024-06-19T03:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a list of zip codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/932924#M366970</link>
      <description>Impressive!</description>
      <pubDate>Wed, 19 Jun 2024 03:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/932924#M366970</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2024-06-19T03:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a list of zip codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/933135#M367030</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 13:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-a-list-of-zip-codes/m-p/933135#M367030</guid>
      <dc:creator>ChickenLittle</dc:creator>
      <dc:date>2024-06-20T13:07:17Z</dc:date>
    </item>
  </channel>
</rss>

