<?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: Formatting Phone Numbers with separated area codes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400509#M97094</link>
    <description>&lt;P&gt;Please post sample data that accurately reflects your data.&amp;nbsp;I can't tell if you have three variables or one variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This paper walks through the different ways to format your phone number.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi31/243-31.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi31/243-31.pdf&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Oct 2017 02:47:11 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-10-03T02:47:11Z</dc:date>
    <item>
      <title>Formatting Phone Numbers with separated area codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400503#M97089</link>
      <description>&lt;P&gt;I am having trouble trying to convert phone numbers into the following format:&lt;/P&gt;&lt;P&gt;(xxx) xxx-xxxx&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;datalines;
9136122 Code=999 Date=6/30/2001
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The outputted format I want is:&lt;/P&gt;&lt;P&gt;Phone = (999) 913-6122&lt;/P&gt;&lt;P&gt;Date = June 30, 2001&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure how to deal with converting 'Code=999' as the area code.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 01:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400503#M97089</guid>
      <dc:creator>Ahzu</dc:creator>
      <dc:date>2017-10-03T01:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Phone Numbers with separated area codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400509#M97094</link>
      <description>&lt;P&gt;Please post sample data that accurately reflects your data.&amp;nbsp;I can't tell if you have three variables or one variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This paper walks through the different ways to format your phone number.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi31/243-31.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi31/243-31.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 02:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400509#M97094</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-03T02:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Phone Numbers with separated area codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400510#M97095</link>
      <description>&lt;P&gt;You have a choice of&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;making the phone number a numeric value with 10 digits&amp;nbsp; (10000000*acode+pnum), and assigning it&amp;nbsp;a format to produce your desired layout, or&lt;/LI&gt;
&lt;LI&gt;creating a character variable with the parentheses, dash, and internal blank.&amp;nbsp; You can do the latter using a couple of CATS functions nested inside a CATX function.&amp;nbsp; For example the area code part could be&amp;nbsp;&amp;nbsp; CATS('(',acode,')').&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 03 Oct 2017 02:52:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400510#M97095</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-10-03T02:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Phone Numbers with separated area codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400511#M97096</link>
      <description>&lt;P&gt;something like this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input phone $ 1-17 date1 $ 18-33 ;
phone = cat('(',substr(trim(phone),14),') ', substr(phone,1,3), '-',substr(phone,1,4));
date= input(substr(date1,6),mmddyy10.);
format date worddate20.;
drop date1;
datalines;
9136122 Code=999 Date=6/30/2001
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Oct 2017 03:11:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400511#M97096</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-10-03T03:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Phone Numbers with separated area codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400517#M97098</link>
      <description>&lt;P&gt;Your program outputs what you request. What's the issue?&lt;/P&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l header" scope="col"&gt;phone&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;date&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;(999) 913-9136&lt;/TD&gt;
&lt;TD class="r data"&gt;June 30, 2001&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh wait, not quite...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  PHONE = cat('(',scan(PHONE,2,'='), ') ', substr(PHONE,1,3), '-',SUBSTR(PHONE,4,4));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l header" scope="col"&gt;PHONE&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;DATE&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;(999 ) 913-6122&lt;/TD&gt;
&lt;TD class="r data"&gt;June 30, 2001&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Oct 2017 05:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400517#M97098</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-10-03T05:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Phone Numbers with separated area codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400523#M97099</link>
      <description>&lt;P&gt;SAS lets you read this type of data directly.&amp;nbsp; Here's the documentation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.2&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=p1jjrvmzmybdeqn1gt8gj1r0ed0u.htm&amp;amp;locale=en#p0bj1u9rp3n45in1j19p677jp6ik" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.2&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=p1jjrvmzmybdeqn1gt8gj1r0ed0u.htm&amp;amp;locale=en#p0bj1u9rp3n45in1j19p677jp6ik&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 06:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-Phone-Numbers-with-separated-area-codes/m-p/400523#M97099</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-10-03T06:44:34Z</dc:date>
    </item>
  </channel>
</rss>

