<?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 Distinct values for multiple  columns in single syntax in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807015#M40524</link>
    <description>&lt;P&gt;How can I determine the distinct values of many variables with just one syntax?&lt;/P&gt;&lt;P&gt;For instance to know the distinct values of 'Make' from Sashelp. cars data set, the syntax is as follows:&lt;BR /&gt;proc sql;&lt;BR /&gt;select distinct(make)&lt;BR /&gt;from sashelp.cars;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BUT if we would like to know the distinct values of all the variables in one syntax?&lt;/P&gt;</description>
    <pubDate>Sun, 10 Apr 2022 12:43:50 GMT</pubDate>
    <dc:creator>Sharan</dc:creator>
    <dc:date>2022-04-10T12:43:50Z</dc:date>
    <item>
      <title>Distinct values for multiple  columns in single syntax</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807015#M40524</link>
      <description>&lt;P&gt;How can I determine the distinct values of many variables with just one syntax?&lt;/P&gt;&lt;P&gt;For instance to know the distinct values of 'Make' from Sashelp. cars data set, the syntax is as follows:&lt;BR /&gt;proc sql;&lt;BR /&gt;select distinct(make)&lt;BR /&gt;from sashelp.cars;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BUT if we would like to know the distinct values of all the variables in one syntax?&lt;/P&gt;</description>
      <pubDate>Sun, 10 Apr 2022 12:43:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807015#M40524</guid>
      <dc:creator>Sharan</dc:creator>
      <dc:date>2022-04-10T12:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct values for multiple  columns in single syntax</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807040#M40526</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/338281"&gt;@Sharan&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a quick overview you can use PROC FREQ:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=sashelp.cars;
tables _all_ / missing;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Apr 2022 16:09:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807040#M40526</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-04-10T16:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct values for multiple  columns in single syntax</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807094#M40527</link>
      <description>&lt;P&gt;Before actually listing the VALUES I would suggest getting an idea just how many there might be. The Proc Freq Nlevels will do that. Coupled with ODS SELECT that is the only thing in the result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ods select nlevels;
proc freq data=sashelp.cars nlevels;
tables _all_ / missing;
run; &lt;/PRE&gt;
&lt;P&gt;Consider if you run Proc Freq on a data set that has a unique identifier for every record and the data set is moderately large. You may end up printing millions of records with one value each line. (May actually never complete if the data set is large enough).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the output from above you see that the Invoice variable has 425 values. Since there are only 428 observations in the data set that means you have very few duplicated values and use of "distinct Invoice" may not be particularly helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You also get to see quickly which variables have any (&lt;STRONG&gt;not&amp;nbsp;&lt;/STRONG&gt;how many, just if any are) missing values (cylinder the only one in this case because data includes the Mazda RX-8, last of the Wankle engines that use rotors instead of piston/cylinders)&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 05:20:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807094#M40527</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-11T05:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct values for multiple  columns in single syntax</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807133#M40528</link>
      <description>This is very useful. Thank you!</description>
      <pubDate>Mon, 11 Apr 2022 11:37:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807133#M40528</guid>
      <dc:creator>Sharan</dc:creator>
      <dc:date>2022-04-11T11:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct values for multiple  columns in single syntax</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807169#M40529</link>
      <description>&lt;P&gt;If you just want the NLEVELS printed without the actual values then just use the / NOPRINT option on the TABLES statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=sashelp.class nlevels;
  tables _all_ / noprint;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Apr 2022 13:51:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Distinct-values-for-multiple-columns-in-single-syntax/m-p/807169#M40529</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-11T13:51:46Z</dc:date>
    </item>
  </channel>
</rss>

