<?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: looking for uniques among 10 variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231018#M41982</link>
    <description>&lt;P&gt;This might be the most flexible approach, for future analysis purposes.&amp;nbsp; It produces 10 new variables (count1-count10), containing a count of how many times the phone number appears within the set of 10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; array phone {10};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; array count {10};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; do i=1 to 10;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count{i}=0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; do i=1 to 10;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j=1 to 10;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if phone{i} = phone{j} then count{i} + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So uniqueness is identified as a COUNT variable being 1.&amp;nbsp; But you can also look for low counts, not just unique vs. not unique.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Oct 2015 18:32:46 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2015-10-21T18:32:46Z</dc:date>
    <item>
      <title>looking for uniques among 10 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231010#M41976</link>
      <description>&lt;P&gt;I have a dataset with phone numbers.&amp;nbsp; There are 10 phone number fields for each observation. phone1 to phone10.&amp;nbsp; What I am trying to do is determine if the number in phone1&amp;nbsp;is unique versus the number in fields phone2 through phone10.&amp;nbsp; Also, is phone2 unique against all the other phone fields, etc. I can do this with a bunch of if statements, but I was thinking there must be a macro way to do this that would be less prone to typing error.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 17:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231010#M41976</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2015-10-21T17:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: looking for uniques among 10 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231011#M41977</link>
      <description>&lt;P&gt;With respect to a macro solution versus a data step solution, both would require do loops, and I don't see one as being easier or simpler or less coding than the other.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 18:04:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231011#M41977</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-10-21T18:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: looking for uniques among 10 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231013#M41979</link>
      <description>&lt;P&gt;What is your purpose? What would be your final outcome? Are you de-dup the phone numbers or Are you only select those unique? The best way to explain is to offer a set of HAVE/WANT, along with your descriptions.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 18:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231013#M41979</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-10-21T18:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: looking for uniques among 10 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231014#M41980</link>
      <description>&lt;P&gt;This will create pairs of values that are same&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
	set test;
	length x $100;
	x="";
	array test{*} var1-var10;
	do i=1 to dim(test)-1;
		do j=1 to dim(test)-i;
			if test{i}=test{i+j} then x=strip(x)||" "||strip(put(i,best.))||"-"||strip(put(i+j,best.));
		end;
	end;
	drop i j;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Oct 2015 18:20:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231014#M41980</guid>
      <dc:creator>ndp</dc:creator>
      <dc:date>2015-10-21T18:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: looking for uniques among 10 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231015#M41981</link>
      <description>&lt;P&gt;I want to get a a number of uniques for each phone variable category by a group of other variables. So breaking it out by day of the week, by agency, and other things.&amp;nbsp; So how many uniques are there for each phone1, .... phone 10.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 18:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231015#M41981</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2015-10-21T18:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: looking for uniques among 10 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231018#M41982</link>
      <description>&lt;P&gt;This might be the most flexible approach, for future analysis purposes.&amp;nbsp; It produces 10 new variables (count1-count10), containing a count of how many times the phone number appears within the set of 10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; array phone {10};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; array count {10};&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; do i=1 to 10;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count{i}=0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; do i=1 to 10;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j=1 to 10;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if phone{i} = phone{j} then count{i} + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So uniqueness is identified as a COUNT variable being 1.&amp;nbsp; But you can also look for low counts, not just unique vs. not unique.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 18:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231018#M41982</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-21T18:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: looking for uniques among 10 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231197#M42035</link>
      <description>&lt;P&gt;Hi.&amp;nbsp; If all you want to do is identify the unique phone numbers in each observation, you could try this ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;proc format;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;picture phone (default=14) low-high='999)-999-9999' (prefix='(');&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data phone;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;input id p1-p10 @@;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;datalines; &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;123&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;9999999999 1234567890 3234567890 4234567890 &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;5234567890 6234567890 7234567890 9234567890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;1234567890 9234567890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;234&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;6234567890 1234567890 9234567890 8234567890 &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;5234567890 6234567890 7234567890 1234567890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;1234567890 6234567890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data u_phone (keep=id phone);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;set phone;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;array p(10);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;all = catx('|',of p(*));&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;do i=1 to 10;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; if lengthn(tranwrd(all,cat(p(i)),'*')) eq 100 then do; phone=p(i); output; end;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;format phone phone.;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;data set U_PHONE ...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;id=123&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; phone&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; (999)-999-9999&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; (323)-456-7890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; (423)-456-7890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp; (523)-456-7890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp; (623)-456-7890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp; (723)-456-7890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;id=234&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; phone&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; (923)-456-7890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp; (823)-456-7890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; (523)-456-7890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;10&amp;nbsp;&amp;nbsp;&amp;nbsp; (723)-456-7890&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 16:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/looking-for-uniques-among-10-variables/m-p/231197#M42035</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2015-10-22T16:08:58Z</dc:date>
    </item>
  </channel>
</rss>

