<?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: Proc Freq Missing Values all Fields in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/390278#M93590</link>
    <description>&lt;P&gt;Post a new question and post what you've tried so far.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Aug 2017 14:48:16 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-08-23T14:48:16Z</dc:date>
    <item>
      <title>Proc Freq Missing Values all Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/387784#M92992</link>
      <description>&lt;P&gt;Original Post:&lt;/P&gt;&lt;P&gt;________________________________________&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to run a proc freq on all the fields (columns) and count the missing values. I have more than 100 fields - is there a way to use wildcard for all fields like *&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;Age &amp;nbsp; Race &amp;nbsp; &amp;nbsp;Ethnicity &amp;nbsp; Gender&lt;/P&gt;&lt;P&gt;10 &amp;nbsp; &amp;nbsp; &amp;nbsp;W &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;W &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&lt;/P&gt;&lt;P&gt;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;W &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;F&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final table should look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Missing &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Not Missing &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Total&lt;/P&gt;&lt;P&gt;Age &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;Race &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;Ethnicity &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Gender &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_Original question was solved - Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_____________________________________________________________&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 15:39:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/387784#M92992</guid>
      <dc:creator>AZIQ1</dc:creator>
      <dc:date>2017-08-23T15:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Missing Values all Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/387793#M92994</link>
      <description>&lt;P&gt;You can use the shortcuts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;_all_ -&amp;gt; all variables&lt;/P&gt;
&lt;P&gt;_character_ -&amp;gt; all character variables&lt;/P&gt;
&lt;P&gt;_numeric_ -&amp;gt; all numeric variables&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*create sample data to work with;
data class;
	set sashelp.class;

	if age=14 then
		call missing(height, weight, sex);

	if name='Alfred' then
		call missing(sex, age, height);
	label age="Fancy Age Label";
run;

*create format for missing;
proc format ;
	value $ missfmt ' '="Missing" other="Not Missing";
	value nmissfmt .="Missing" other="Not Missing";
run;

*Proc freq to count missing/non missing;
ods table onewayfreqs=temp;
proc freq data=class;
	table _all_ / missing;
	format _numeric_ nmissfmt. _character_ $missfmt.;
run;

*Format output;
data want;
	length variable $32. variable_value $50.;
	set temp;
	Variable=scan(table, 2);
	Variable_Value=strip(trim(vvaluex(variable)));
	keep variable variable_value frequency percent cum:;
	label variable='Variable' variable_value='Variable Value';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Aug 2017 14:43:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/387793#M92994</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-14T14:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Missing Values all Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/387803#M92995</link>
      <description>Thank you so much, the last part - "Format Output" has 0 observations, is there something missing?&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Aug 2017 15:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/387803#M92995</guid>
      <dc:creator>AZIQ1</dc:creator>
      <dc:date>2017-08-14T15:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Missing Values all Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/387809#M92998</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/23718"&gt;@AZIQ1&lt;/a&gt; wrote:&lt;BR /&gt;Thank you so much, the last part - "Format Output" has 0 observations, is there something missing?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you tried to use this with your data or the sample program? Please include more details in your posts, remember we can't see your computer or know what you're referring to unless you explicitly state it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The program above works fine on my machine and generates the results:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;509&lt;BR /&gt;510 *Format output;&lt;BR /&gt;511 data want;&lt;BR /&gt;512 length variable $32. variable_value $50.;&lt;BR /&gt;513 set temp;&lt;BR /&gt;514 Variable=scan(table, 2);&lt;BR /&gt;515 Variable_Value=strip(trim(vvaluex(variable)));&lt;BR /&gt;516 keep variable variable_value frequency percent cum:;&lt;BR /&gt;517 label variable='Variable' variable_value='Variable Value'&lt;BR /&gt;517! ;&lt;BR /&gt;518 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 9 observations read from the data set WORK.TEMP.&lt;BR /&gt;NOTE: The data set WORK.WANT has 9 observations and 6 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.03 seconds&lt;BR /&gt; cpu time 0.03 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 15:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/387809#M92998</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-14T15:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Missing Values all Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/387815#M93001</link>
      <description>Thank you so much, it worked.&lt;BR /&gt;Point noted : Re: Posting&lt;BR /&gt;&lt;BR /&gt;Best</description>
      <pubDate>Mon, 14 Aug 2017 15:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/387815#M93001</guid>
      <dc:creator>AZIQ1</dc:creator>
      <dc:date>2017-08-14T15:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Missing Values all Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/388162#M93099</link>
      <description>&lt;PRE&gt;

data have;
input Age   (Race    Ethnicity   Gender) ($);
cards;
10      W              C              .
.          W              C             M
.          W              C              F
;
run;
proc sql;
select 'Age    ',nmiss(age) as missing,n(age) as Not_Missing,count(*) as total from have
union
select 'Race    ',nmiss(Race) as missing,n(Race) as Not_Missing,count(*) as total from have
union
select 'Ethnicity    ',nmiss(Ethnicity) as missing,n(Ethnicity) as Not_Missing,count(*) as total from have
;
quit;


&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Aug 2017 14:27:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/388162#M93099</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-08-15T14:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Missing Values all Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/389990#M93512</link>
      <description>Thank you again,&lt;BR /&gt;I want to stratify proc freq using by variable-&lt;BR /&gt;how can I format output so that I get the out put by my stratified vars. e.g by year and class.</description>
      <pubDate>Tue, 22 Aug 2017 19:19:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/389990#M93512</guid>
      <dc:creator>AZIQ1</dc:creator>
      <dc:date>2017-08-22T19:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Missing Values all Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/390278#M93590</link>
      <description>&lt;P&gt;Post a new question and post what you've tried so far.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 14:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Missing-Values-all-Fields/m-p/390278#M93590</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-23T14:48:16Z</dc:date>
    </item>
  </channel>
</rss>

