<?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 Phone number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397405#M96044</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sure this topic has been done to death, but I have a relatively simple problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have &amp;nbsp;about a hundred phone numbers in the format&amp;nbsp;333--2964555 I want to put it into the format (555) 333-2964. I can add in the parentheses, spaces and dashes, but I can't figure out how to move the last 3 numbers to the front i.e so that&amp;nbsp;&lt;SPAN&gt;3332964555 becomes 5553332964 after my compress function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've just attached my code for 3 of the numbers;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data phone_a;&lt;BR /&gt;input ph $1-16;&lt;BR /&gt;datalines;&lt;BR /&gt;&lt;SPAN&gt;333--2964555 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;376--4232444&lt;/P&gt;&lt;P&gt;445--6777555&lt;BR /&gt;;&lt;BR /&gt;data b;&lt;BR /&gt;set phone_a;&lt;BR /&gt;base=compress(ph,"--.");&lt;BR /&gt;data c;&lt;BR /&gt;set b;&lt;BR /&gt;Phone_number=input(base,12.);&lt;BR /&gt;proc format;&lt;BR /&gt;picture phone_b (default=16)&lt;BR /&gt;low-high='999) 999-9999'&lt;BR /&gt;(prefix='(');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=c;&lt;BR /&gt;format Phone_number phone_b.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2017 12:24:36 GMT</pubDate>
    <dc:creator>harcluna</dc:creator>
    <dc:date>2017-09-20T12:24:36Z</dc:date>
    <item>
      <title>Phone number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397405#M96044</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sure this topic has been done to death, but I have a relatively simple problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have &amp;nbsp;about a hundred phone numbers in the format&amp;nbsp;333--2964555 I want to put it into the format (555) 333-2964. I can add in the parentheses, spaces and dashes, but I can't figure out how to move the last 3 numbers to the front i.e so that&amp;nbsp;&lt;SPAN&gt;3332964555 becomes 5553332964 after my compress function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've just attached my code for 3 of the numbers;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data phone_a;&lt;BR /&gt;input ph $1-16;&lt;BR /&gt;datalines;&lt;BR /&gt;&lt;SPAN&gt;333--2964555 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;376--4232444&lt;/P&gt;&lt;P&gt;445--6777555&lt;BR /&gt;;&lt;BR /&gt;data b;&lt;BR /&gt;set phone_a;&lt;BR /&gt;base=compress(ph,"--.");&lt;BR /&gt;data c;&lt;BR /&gt;set b;&lt;BR /&gt;Phone_number=input(base,12.);&lt;BR /&gt;proc format;&lt;BR /&gt;picture phone_b (default=16)&lt;BR /&gt;low-high='999) 999-9999'&lt;BR /&gt;(prefix='(');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=c;&lt;BR /&gt;format Phone_number phone_b.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 12:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397405#M96044</guid>
      <dc:creator>harcluna</dc:creator>
      <dc:date>2017-09-20T12:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Phone number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397419#M96050</link>
      <description>&lt;P&gt;Perl Regular expression will be very handy in this situation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data phone_a;
input ph $1-16;
ph_new=prxchange('s/(\d{3})(--)(\d{3})/(\1)\3-/o',1,ph);
datalines;
333--2964555 
376--4232444
445--6777555
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ion&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 12:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397419#M96050</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2017-09-20T12:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Phone number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397422#M96052</link>
      <description>&lt;PRE&gt;

data phone_a;
input ph $1-16;
datalines;
333--2964555
376--4232444
445--6777555
;
run;
data want;
 set phone_a;
 want=cats('(',substr(ph,length(ph)-2),')',substr(ph,1,length(ph)-3));
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Sep 2017 13:09:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397422#M96052</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-09-20T13:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: Phone number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397445#M96056</link>
      <description>&lt;P&gt;One side issue to note here ... when the CATS function creates a new variable, SAS assigns the new variable a length of $200.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 13:49:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397445#M96056</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-09-20T13:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Phone number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397459#M96058</link>
      <description>&lt;P&gt;Here is Ron Cody's tip for standardizing phone numbers in SAS.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2017/05/26/standardizing-phone-numbers-using-sas/" target="_self"&gt;https://blogs.sas.com/content/sastraining/2017/05/26/standardizing-phone-numbers-using-sas/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 14:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397459#M96058</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-09-20T14:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Phone number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397476#M96065</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Here is Ron Cody's tip for standardizing phone numbers in SAS.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2017/05/26/standardizing-phone-numbers-using-sas/" target="_self"&gt;https://blogs.sas.com/content/sastraining/2017/05/26/standardizing-phone-numbers-using-sas/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;One caution about standardizing phone numbers: Find out if the data may have internation numbers before you start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We had a process similar to Ron Cody's for standardizing phone numbers and had issues with lots of responses when called of "I have no idea what you are talking about." The data turned out to have international numbers (South America) and some of the numbers when standardized created valid US phone numbers from international code+phone number. Which obviously were not the correct contacts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 15:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Phone-number/m-p/397476#M96065</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-20T15:03:09Z</dc:date>
    </item>
  </channel>
</rss>

