<?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: Extracting numbers from Excel cell with numbers and text in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/532301#M6009</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192118"&gt;@iressa131&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I just realized the quotation marks are incorrect because Im using university. so now when I run it I don't get any errors however my output only shows 1 observation with no entry.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC CONTENTS DATA=WORK.IMPORT; RUN;
data WORK.IMPORT;
PhoneNum = compress(agent_details, ,'kd'); 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You didn't include an input data set, in fact you overwrote your data. You'll need to import it again.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data Step1; &lt;FONT size="4" color="#800080"&gt;&lt;STRONG&gt;*output data set name is STEP1;&lt;/STRONG&gt;&lt;/FONT&gt;

set IMPORT; &lt;FONT size="4" color="#800080"&gt;&lt;STRONG&gt;*input data set name is IMPORT;&lt;/STRONG&gt;&lt;/FONT&gt;

PhoneNum = compress(agent_details, ,'kd'); 

run;&lt;/PRE&gt;</description>
    <pubDate>Sat, 02 Feb 2019 17:46:15 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-02-02T17:46:15Z</dc:date>
    <item>
      <title>Extracting numbers from Excel cell with numbers and text</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/531548#M5913</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to extract phone numbers from a data set where they are included in cells with text data (such as emails and name, etc). How would I go about doing this? Another problem is that the entries are not all formatted the same. For example the phone numbers are written in different ways as follows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;123.456.7890&lt;/P&gt;&lt;P&gt;123-456-7890&lt;/P&gt;&lt;P&gt;(123) 456-7890&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are 3500 entries so there may be variations I haven't seen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help you can provide!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 04:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/531548#M5913</guid>
      <dc:creator>iressa131</dc:creator>
      <dc:date>2019-01-31T04:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from Excel cell with numbers and text</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/531552#M5914</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192118"&gt;@iressa131&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to extract phone numbers from a data set where they are included in cells with text data (such as emails and name, etc). How would I go about doing this? Another problem is that the entries are not all formatted the same. For example the phone numbers are written in different ways as follows.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;123.456.7890&lt;/P&gt;
&lt;P&gt;123-456-7890&lt;/P&gt;
&lt;P&gt;(123) 456-7890&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are 3500 entries so there may be variations I haven't seen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for any help you can provide!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;Use the COMPRESS() function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PhoneNum = compress(oldVarName, , ‘kd’);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 05:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/531552#M5914</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-31T05:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from Excel cell with numbers and text</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/531630#M5921</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x $40. ;
want=prxchange('s/\D*(\d\d\d)\D+(\d\d\d)\D+(\d\d\d\d)\D*/$1 $2 $3/o',-1,x);
cards;
123.456.7890
123-456-7890
(123) 456-7890
;
run;


proc print;run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Jan 2019 13:23:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/531630#M5921</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-01-31T13:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from Excel cell with numbers and text</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/531674#M5922</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192118"&gt;@iressa131&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to extract phone numbers from a data set where they are included in cells with text data (such as emails and name, etc). How would I go about doing this? Another problem is that the entries are not all formatted the same. For example the phone numbers are written in different ways as follows.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;123.456.7890&lt;/P&gt;
&lt;P&gt;123-456-7890&lt;/P&gt;
&lt;P&gt;(123) 456-7890&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are 3500 entries so there may be variations I haven't seen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for any help you can provide!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Check&amp;nbsp;the lengths of any of these after the digits only are preserved. You may find extensions or international codes in longer than expected values, missing area codes (7 digit).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then go back to who ever designed the data entry and use a somewhat more modern approach that has area code, exchange (the second 3 digit group) and number entry that will collect these consistently.&lt;/P&gt;
&lt;P&gt;Collecting cleanly is preferred over cleaning collection.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 15:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/531674#M5922</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-31T15:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from Excel cell with numbers and text</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/532279#M6005</link>
      <description>&lt;P&gt;Thanks for the reply! When I run the code I get the following&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-02-02 at 10.47.38 AM.png" style="width: 526px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26794i00FCDCCBAD2E5F37/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-02-02 at 10.47.38 AM.png" alt="Screen Shot 2019-02-02 at 10.47.38 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Feb 2019 15:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/532279#M6005</guid>
      <dc:creator>iressa131</dc:creator>
      <dc:date>2019-02-02T15:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from Excel cell with numbers and text</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/532281#M6006</link>
      <description>&lt;P&gt;I just realized the quotation marks are incorrect because Im using university. so now when I run it I don't get any errors however my output only shows 1 observation with no entry.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC CONTENTS DATA=WORK.IMPORT; RUN;
data WORK.IMPORT;
PhoneNum = compress(agent_details, ,'kd'); 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Feb 2019 16:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/532281#M6006</guid>
      <dc:creator>iressa131</dc:creator>
      <dc:date>2019-02-02T16:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers from Excel cell with numbers and text</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/532301#M6009</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192118"&gt;@iressa131&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I just realized the quotation marks are incorrect because Im using university. so now when I run it I don't get any errors however my output only shows 1 observation with no entry.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC CONTENTS DATA=WORK.IMPORT; RUN;
data WORK.IMPORT;
PhoneNum = compress(agent_details, ,'kd'); 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You didn't include an input data set, in fact you overwrote your data. You'll need to import it again.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data Step1; &lt;FONT size="4" color="#800080"&gt;&lt;STRONG&gt;*output data set name is STEP1;&lt;/STRONG&gt;&lt;/FONT&gt;

set IMPORT; &lt;FONT size="4" color="#800080"&gt;&lt;STRONG&gt;*input data set name is IMPORT;&lt;/STRONG&gt;&lt;/FONT&gt;

PhoneNum = compress(agent_details, ,'kd'); 

run;&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Feb 2019 17:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-numbers-from-Excel-cell-with-numbers-and-text/m-p/532301#M6009</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-02T17:46:15Z</dc:date>
    </item>
  </channel>
</rss>

