<?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: Save proc freq values into new dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750741#M236193</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321018"&gt;@Justin9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks! Is there a way to exclude the 'count' and 'percent' columns in the output (from the out= option, not the proc freq), so that I am left with just the values of the variable?&amp;nbsp;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, you can use data set options in the output such as DROP/KEEP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;tables sex / out=want (drop = percent);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321018"&gt;@Justin9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&amp;nbsp;Is there also a way to exclude the missing row in the output?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, you can use data set options in the output such as WHERE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;tables age / out=want (where = not missing(age));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Putting it all together:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
if age=14 then call missing(age);
run;


proc freq data=class noprint;
tables age / out=want (where=(not missing(age)) 
                       drop = percent  )  ;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Jun 2021 01:40:05 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-06-28T01:40:05Z</dc:date>
    <item>
      <title>Save proc freq values into new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750710#M236171</link>
      <description>&lt;P&gt;Please can someone tell me how to save the unique values that are shown from a proc freq of a variable in the 'Results' tab and save them as a new dataset with just that one variable and all of the values? The proc freq of my variable shows that there are over 100 different values.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jun 2021 20:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750710#M236171</guid>
      <dc:creator>Justin9</dc:creator>
      <dc:date>2021-06-27T20:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Save proc freq values into new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750712#M236172</link>
      <description>&lt;P&gt;You use the OUT= option of the TABLES statement in PROC FREQ.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jun 2021 20:49:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750712#M236172</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-27T20:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Save proc freq values into new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750715#M236175</link>
      <description>Thanks! Is there a way to exclude the 'count' and 'percent' columns in the output (from the out= option, not the proc freq), so that I am left with just the values of the variable? Is there also a way to exclude the missing row in the output?</description>
      <pubDate>Sun, 27 Jun 2021 21:06:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750715#M236175</guid>
      <dc:creator>Justin9</dc:creator>
      <dc:date>2021-06-27T21:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Save proc freq values into new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750720#M236179</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;... so that I am left with just the values of the variable&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can use the NLEVELS option in the PROC FREQ statement if you just want the levels and not the count or percent. And ODS output to get it into a data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jun 2021 21:41:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750720#M236179</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-27T21:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Save proc freq values into new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750728#M236185</link>
      <description>If you just want the unique values, you could do select distinct var from dataset in proc sql.</description>
      <pubDate>Sun, 27 Jun 2021 23:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750728#M236185</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-06-27T23:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Save proc freq values into new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750741#M236193</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321018"&gt;@Justin9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks! Is there a way to exclude the 'count' and 'percent' columns in the output (from the out= option, not the proc freq), so that I am left with just the values of the variable?&amp;nbsp;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, you can use data set options in the output such as DROP/KEEP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;tables sex / out=want (drop = percent);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321018"&gt;@Justin9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&amp;nbsp;Is there also a way to exclude the missing row in the output?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, you can use data set options in the output such as WHERE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;tables age / out=want (where = not missing(age));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Putting it all together:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
if age=14 then call missing(age);
run;


proc freq data=class noprint;
tables age / out=want (where=(not missing(age)) 
                       drop = percent  )  ;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Jun 2021 01:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-proc-freq-values-into-new-dataset/m-p/750741#M236193</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-28T01:40:05Z</dc:date>
    </item>
  </channel>
</rss>

