<?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 convert zipcode to state? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-zipcode-to-state/m-p/787395#M251586</link>
    <description>&lt;P&gt;I understand this part, but as I stated, I first need to create a column that selects the first 5 digits in the zipcode_5 variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;zipstate() does not work for those that have multiple zips, for ex, someone may have a "zipcode_5" of 77550_77555_77553, and zipstate() returns a blank for these.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I need to first create a column called "zip" where it extracts the first 5 digits from zipcode_5 and then run zipstate on the new variable with single zipcodes.&lt;/P&gt;</description>
    <pubDate>Sat, 25 Dec 2021 20:47:25 GMT</pubDate>
    <dc:creator>Student77</dc:creator>
    <dc:date>2021-12-25T20:47:25Z</dc:date>
    <item>
      <title>How to convert zipcode to state?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-zipcode-to-state/m-p/787393#M251584</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have heard of the zipstate() function, but I am not sure how to first get my data in the correct structure to be able to use it. I want to add 2 columns to the following data, a new variable called zipcode, and a new one called state&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;So I want to figure out first how to extract the first zip, ie the first 5 digits from "zipcode_5"&amp;nbsp; ( we will use the first zipcode, even when there are multiple, since only the state will matter). and then create a state variable, that uses the newly created, single zipcode&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 648px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66962i8DE6DEE5D69205DF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Dec 2021 20:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-zipcode-to-state/m-p/787393#M251584</guid>
      <dc:creator>Student77</dc:creator>
      <dc:date>2021-12-25T20:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert zipcode to state?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-zipcode-to-state/m-p/787394#M251585</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;state=zipstate(substr(zipcode_5,1,5));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The SUBSTR function in this case selects the first 5 characters.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Dec 2021 20:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-zipcode-to-state/m-p/787394#M251585</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-25T20:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert zipcode to state?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-zipcode-to-state/m-p/787395#M251586</link>
      <description>&lt;P&gt;I understand this part, but as I stated, I first need to create a column that selects the first 5 digits in the zipcode_5 variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;zipstate() does not work for those that have multiple zips, for ex, someone may have a "zipcode_5" of 77550_77555_77553, and zipstate() returns a blank for these.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I need to first create a column called "zip" where it extracts the first 5 digits from zipcode_5 and then run zipstate on the new variable with single zipcodes.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Dec 2021 20:47:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-zipcode-to-state/m-p/787395#M251586</guid>
      <dc:creator>Student77</dc:creator>
      <dc:date>2021-12-25T20:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert zipcode to state?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-zipcode-to-state/m-p/787396#M251587</link>
      <description>&lt;P&gt;perfect thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 25 Dec 2021 20:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-zipcode-to-state/m-p/787396#M251587</guid>
      <dc:creator>Student77</dc:creator>
      <dc:date>2021-12-25T20:52:36Z</dc:date>
    </item>
  </channel>
</rss>

