<?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 Simple distinct in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Simple-distinct/m-p/69533#M15072</link>
    <description>Hi All,&lt;BR /&gt;
 I have a small question.&lt;BR /&gt;
Say I need to find the count of distinct values for each of the following in a dataset that has&lt;BR /&gt;
more than a million records for my analysis:&lt;BR /&gt;
complaint_id&lt;BR /&gt;
indicator&lt;BR /&gt;
dataentry_date&lt;BR /&gt;
assignment_reassignment_date&lt;BR /&gt;
complainant_type&lt;BR /&gt;
contract_id&lt;BR /&gt;
complaint_cat_id&lt;BR /&gt;
category_description&lt;BR /&gt;
complaint_subcat_id&lt;BR /&gt;
subcategory_description&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 select count(distinct compliant_id) from table1;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
I will have to run this multiple times and it will take time.I'm wondering if there is any way i can accomplish this in one step?</description>
    <pubDate>Thu, 15 Jan 2009 21:56:16 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2009-01-15T21:56:16Z</dc:date>
    <item>
      <title>Simple distinct</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-distinct/m-p/69533#M15072</link>
      <description>Hi All,&lt;BR /&gt;
 I have a small question.&lt;BR /&gt;
Say I need to find the count of distinct values for each of the following in a dataset that has&lt;BR /&gt;
more than a million records for my analysis:&lt;BR /&gt;
complaint_id&lt;BR /&gt;
indicator&lt;BR /&gt;
dataentry_date&lt;BR /&gt;
assignment_reassignment_date&lt;BR /&gt;
complainant_type&lt;BR /&gt;
contract_id&lt;BR /&gt;
complaint_cat_id&lt;BR /&gt;
category_description&lt;BR /&gt;
complaint_subcat_id&lt;BR /&gt;
subcategory_description&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 select count(distinct compliant_id) from table1;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
I will have to run this multiple times and it will take time.I'm wondering if there is any way i can accomplish this in one step?</description>
      <pubDate>Thu, 15 Jan 2009 21:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-distinct/m-p/69533#M15072</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-01-15T21:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Simple distinct</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-distinct/m-p/69534#M15073</link>
      <description>One way that only passes the big dataset once is to use PROC FREQ and output the one-way frequencies.  You'll need to use one TABLES statement (with the OUT= option) for each variable.  The record count for each output dataset is the number of unique values for each variable.  Not elegant, but effective and reasonably efficient.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke</description>
      <pubDate>Fri, 16 Jan 2009 02:42:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-distinct/m-p/69534#M15073</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-01-16T02:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Simple distinct</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-distinct/m-p/69535#M15074</link>
      <description>If you like you can use SQL as well, just add a count distinct for each of your columns. Not sure though how PROC SQL will process this internally regarding to efficiency.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Fri, 16 Jan 2009 08:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-distinct/m-p/69535#M15074</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-01-16T08:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Simple distinct</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-distinct/m-p/69536#M15075</link>
      <description>I just ran into this thread while looking for something else. Just for the record (almost certainly too late for the original poster), there is a very easy way to do this -- the NLEVELS option of PROC FREQ:&lt;BR /&gt;
&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods output NLevels=CountOfDistinctValues;&lt;BR /&gt;
&lt;BR /&gt;
proc freq  data=sashelp.class  nlevels;&lt;BR /&gt;
tables _all_;&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
ods output close;&lt;BR /&gt;
ods listing;</description>
      <pubDate>Thu, 04 Nov 2010 20:21:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-distinct/m-p/69536#M15075</guid>
      <dc:creator>MikeRhoads</dc:creator>
      <dc:date>2010-11-04T20:21:13Z</dc:date>
    </item>
  </channel>
</rss>

