<?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: Reading phone data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/651228#M195366</link>
    <description>Thanks for your time!!</description>
    <pubDate>Wed, 27 May 2020 21:23:02 GMT</pubDate>
    <dc:creator>vicky07</dc:creator>
    <dc:date>2020-05-27T21:23:02Z</dc:date>
    <item>
      <title>Reading phone data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/650973#M195247</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I receive data from vendor which looks something like below. It has 8 phone number columns(char) from tp1 to tp8 and there are could be missing phone numbers in between for each ID. For instance, I could get a record where tp1 &amp;amp; tp8 columns are populated populated and rest of the phone columns are blank.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
Data have;
input @1 ID :$4. @6 tp1 $10. @17 tp2 $10. @28 tp3 $10. @39 tp4 $10. @50 tp5 $10. @61 tp6 $10. @72 tp7 $10. @83 tp8 :$10.  ;
infile cards missover ;
cards;
1325 5872584458	2478569877	                                         					
1325 5872584458			   3697489567 				
5489 8658656767 		              6048795248 
5478 2358984155 							
5478 2358984155 							
8799 4897568698                                                                         3697489567
8799 4897568698 																		3697489567
;
run;	&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want an output that captures all the phone numbers in a single column and dedup them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;BR /&gt;tp&lt;BR /&gt;5872584458&lt;BR /&gt;2478569877&lt;BR /&gt;3697489567&lt;BR /&gt;8658656767&lt;BR /&gt;6048795248&lt;BR /&gt;2358984155&lt;BR /&gt;4897568698&lt;BR /&gt;3697489567&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance for your help!!&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 04:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/650973#M195247</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2020-05-27T04:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Reading phone data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/650974#M195248</link>
      <description>&lt;P&gt;Transpose, then sort:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose
  data=have
  out=want (
    drop=_name_
    rename=(col1=tp)
    where=(tp ne " ")
  )
;
by id;
var tp:;
run;

proc sort data=want nodupkey;
by id tp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Untested, posted from my tablet.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 05:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/650974#M195248</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-27T05:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reading phone data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/650990#M195256</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/9440"&gt;@vicky07&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is another approach than the one proposed by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;, using an array:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (keep=tp);
	set have;
	array _tp (*) tp:;
	do i=1 to dim(_tp);
		if not missing(_tp(i)) then do;
			tp=_tp(i);
			output;
		end;
	end;
run;

proc sort data=want nodupkey;
	by tp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 07:00:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/650990#M195256</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-27T07:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Reading phone data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/650997#M195262</link>
      <description>&lt;P&gt;Since you have multiple observations per ID, the simple transpose approach does not work; use&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt;'s array code.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 07:39:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/650997#M195262</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-27T07:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Reading phone data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/651226#M195365</link>
      <description>Thank You!!</description>
      <pubDate>Wed, 27 May 2020 21:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/651226#M195365</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2020-05-27T21:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reading phone data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/651228#M195366</link>
      <description>Thanks for your time!!</description>
      <pubDate>Wed, 27 May 2020 21:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-phone-data/m-p/651228#M195366</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2020-05-27T21:23:02Z</dc:date>
    </item>
  </channel>
</rss>

