<?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: Assigning values for postal codes in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118720#M32757</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="1025" data-externalid="" data-presence="null" data-userid="5068" data-username="Hai.kuo" href="https://communities.sas.com/people/Hai.kuo" id="jive-506877801759512825803"&gt;Hai.kuo&lt;/A&gt;,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;I ran your code and compared the output with the output produced by Murray_Court's code.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;compare&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=have &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;compare&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=want; &lt;/SPAN&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Both code produced identical resutls. Thank you so much.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;First, I will read some literature to understand what is happening in your magical code and then come back to you if still I cannot understand this code logic.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Mirisage&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 Aug 2013 03:35:26 GMT</pubDate>
    <dc:creator>Mirisage</dc:creator>
    <dc:date>2013-08-24T03:35:26Z</dc:date>
    <item>
      <title>Assigning values for postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118712#M32749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SAS Forum,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*Hi SAS Forum,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;I have this data set. It shows the postal codes of each account.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;But the postal_code field has a mix of values. Some are correct, some are strange, some are wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; account_number postal_code $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;6&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="FR" style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN lang="FR" style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="FR" style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;1111 T2H 1B5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="FR" style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;2222 T9E 6C8&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="FR" style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;3333 01000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;4444 1097C7&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;5555 123&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;7777 A0A 1K0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;9999 J0N 1G3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;8888 11654-2011&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;1234 T9W 3H2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;I wanted to create a new variable called "Validation" with following rules.&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;If a postal code start with T, and it has 6 chractoers, and first charactoer is a letter, second is a numeric, third is a letter, fourth is a space, &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;fifth is a numeric, sixth is a letter, 7th is a numeric&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;then validation = 'correct'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;If a postal code starts with a letter which is not T, and all the other conditions above are satisfied, then validation = 'wrong'&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;Else validation ='strange'&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*For clarity, I have indicated below the values of variable "Validation" in front of each record*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; account_number postal_code $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;6&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;12 validation&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;1111 T2H 1B5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*correct*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;2222 T9E 6C8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*correct*/ &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;3333 01000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*strange*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;4444 1097C7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*strange*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;5555 123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*strange*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;7777 A0A 1K0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*wrong*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;9999 J0N 1G3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*wrong*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="FR" style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;8888 T1654-2011&amp;nbsp;&amp;nbsp; /*strange*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="FR" style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;1234 T9W 3H2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*correct*/&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Q: Could someone help me how to do this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Thanks for your time.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Miris&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 01:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118712#M32749</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2013-08-22T01:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning values for postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118713#M32750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some conditional logic should help here, with the use of the substring function.&lt;/P&gt;&lt;P&gt;I don't have SAS o my home computer so I havnt been able to check for errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* define lists of numbers and letters, although I suspect SAS may have a shortcut for this. */&lt;/P&gt;&lt;P&gt;%let nums = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");&lt;/P&gt;&lt;P&gt;%let letters = ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");&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;if&lt;/P&gt;&lt;P&gt;upcase(substr(postal_code,1,1)). = "T"&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;substr(postal_code,2,1) in &amp;amp;nums.&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;upcase(substr(postal_code,3,1)) in &amp;amp;letters.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;substr(postal_code,4,1) = " "&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;substr(postal_code,5,1) in &amp;amp;nums.&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;upcase(substr(postal_code,6,1)) in &amp;amp;letters.&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;substr(postal_code,7,1) in &amp;amp;nums.&lt;/P&gt;&lt;P&gt;then &lt;SPAN style="color: #008000; font-family: 'Courier New'; font-size: 15px; background-color: #ffffff;"&gt;validation = "correct&lt;/SPAN&gt;";&lt;/P&gt;&lt;P&gt;/*if the mength of your field is more than 7 characters you may want to check if the remaining ones are blank,&lt;/P&gt;&lt;P&gt;in your example the field post_code has 7 characters so no check needed */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else if&lt;/P&gt;&lt;P&gt;upcase(substr(postal_code,1,1)) in &amp;amp;letters&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;substr(postal_code,2,1) in &amp;amp;nums.&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;upcase(substr(postal_code,3,1)) in &amp;amp;letters.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;substr(postal_code,4,1) = " "&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;substr(postal_code,5,1) in &amp;amp;nums.&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;upcase(substr(postal_code,6,1)) in &amp;amp;letters.&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;substr(postal_code,7,1) in &amp;amp;nums.&lt;/P&gt;&lt;P&gt;then &lt;SPAN style="color: #008000; font-family: 'Courier New'; font-size: 15px; background-color: #ffffff;"&gt;validation = "wrong&amp;nbsp; &lt;/SPAN&gt;"; /*extra spaces needed to avoid truncation */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else validation="strange";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 06:17:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118713#M32750</guid>
      <dc:creator>Murray_Court</dc:creator>
      <dc:date>2013-08-22T06:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning values for postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118714#M32751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Concept:&lt;/P&gt;&lt;P&gt;use a regular expression catching correct and wrong postal codes - strange codes do not match the expression. Use first-function to verify that the code starts with "T".&lt;/P&gt;&lt;P&gt;RegEx:&lt;SPAN style="font-family: courier new,courier;"&gt; /^[A-Z]\d[A-Z] \d[A-Z]\d$/&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 08:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118714#M32751</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2013-08-22T08:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning values for postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118715#M32752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This code could be simplified by:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;applying the position 1 test at the end - make the need for repeating the conditions for all other positions twice&lt;/LI&gt;&lt;LI&gt;using anydigit() and anyalpha() functions - no need to use hard coded macro variables. &lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 09:44:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118715#M32752</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-08-22T09:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning values for postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118716#M32753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Postal codes a generally public information. Couldn't you try to builds a lookup table, and testing using that (i.e. SAS formats). That will give you correct at least.&lt;/P&gt;&lt;P&gt;Since I assume this is some kind of data quality applications, how big is this work? Many rows, how often etc? You might want to look a DQ tool that can automate a great part of this process.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 09:47:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118716#M32753</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-08-22T09:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning values for postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118717#M32754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Canada, postal codes are owned by Canada Post and not generally public :smileyconfused:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, even if a postal code is in the correct format it may not be a valid postal code, for example, X are rarely used in postal codes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on who you work for, you may have access to a list of valid postal codes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A list of Canadian postal codes, crowd sourced (quality not assured) is here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://geocoder.ca/?freedata=1" title="http://geocoder.ca/?freedata=1"&gt;geocoder.ca: geocoding for North America - USA and Canada&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 14:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118717#M32754</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-08-22T14:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning values for postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118718#M32755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Murray_Court,&lt;/P&gt;&lt;P&gt;Thank you very much for this code, it worked very well. And I learned a lot how to handle &lt;BR /&gt;this kind of coding tasks.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hi andreas_lds&lt;BR /&gt;This is the first time I heard about "Regular expressions". I serached in the google &lt;BR /&gt;and now I have some understanding. Thanks a lot for introducing this.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hi LinusH &lt;BR /&gt;I should try your short cut and compare with Murray_Court's resutls. Thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Reeza&lt;BR /&gt;I learned the term "crowd sourced", and many thanks for the postal code site as well.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mirisage&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Aug 2013 12:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118718#M32755</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2013-08-23T12:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning values for postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118719#M32756</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 account_number postal_code $ 6-12;&lt;/P&gt;&lt;P&gt;length flag $ 7;&lt;/P&gt;&lt;P&gt;if prxmatch('/^T\d[A-Z] \d[A-Z]\d$/',postal_code) then flag='correct';&lt;/P&gt;&lt;P&gt;else if prxmatch('/^[^T]\d[A-Z] \d[A-Z]\d$/',postal_code) then flag='wrong';&lt;/P&gt;&lt;P&gt;else flag='strange';&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1111 T2H 1B5&lt;/P&gt;&lt;P&gt;2222 T9E 6C8&lt;/P&gt;&lt;P&gt;3333 01000&lt;/P&gt;&lt;P&gt;4444 1097C7&lt;/P&gt;&lt;P&gt;5555 123&lt;/P&gt;&lt;P&gt;7777 A0A 1K0&lt;/P&gt;&lt;P&gt;9999 J0N 1G3&lt;/P&gt;&lt;P&gt;8888 11654-2011&lt;/P&gt;&lt;P&gt;1234 T9W 3H2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Aug 2013 14:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118719#M32756</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-08-23T14:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning values for postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118720#M32757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="1025" data-externalid="" data-presence="null" data-userid="5068" data-username="Hai.kuo" href="https://communities.sas.com/people/Hai.kuo" id="jive-506877801759512825803"&gt;Hai.kuo&lt;/A&gt;,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;I ran your code and compared the output with the output produced by Murray_Court's code.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;compare&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=have &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;compare&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=want; &lt;/SPAN&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Both code produced identical resutls. Thank you so much.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;First, I will read some literature to understand what is happening in your magical code and then come back to you if still I cannot understand this code logic.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Mirisage&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Aug 2013 03:35:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assigning-values-for-postal-codes/m-p/118720#M32757</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2013-08-24T03:35:26Z</dc:date>
    </item>
  </channel>
</rss>

