<?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: Re-arranging output of proc freq in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406229#M279284</link>
    <description>&lt;PRE&gt;
That would be a lot easy for SQL.

data test;
do i = 1 to 100;
output;
end;
run;

data test1;
b = .;
run;

data test2;
c = '';
D = '';
run;

data fin;
set test test1 test2;
run;

data _null_;
 set sashelp.vcolumn(where=(libname='WORK' and memname='FIN')) end=last;
 if _n_=1 then call execute('proc sql; ');
 call execute(catt('select "',name,'" as variable length=40,count(*) as nobs,',
 ' nmiss(',name,') as nmissing from WORK.FIN'));
 if last then call execute(';quit;');
  else call execute('union');
run;


&lt;/PRE&gt;</description>
    <pubDate>Sat, 21 Oct 2017 12:18:27 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2017-10-21T12:18:27Z</dc:date>
    <item>
      <title>Re-arranging output of proc freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406161#M279280</link>
      <description>&lt;P&gt;I would like to analyse given data set and display number of complete/missing observations so that they had the structure as can be seen in the attached picture:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 311px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16121i6BD117793FD80964/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I am trying to amend to get such output is here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data test;
do i = 1 to 100;
output;
end;
run;

data test1;
b = .;
run;

data test2;
c = '';
D = '';
run;

data fin;
set test test1 test2;
run;

proc format;
	value $missfmt ' '='Missing' other='Not Missing';
	value missfmt .='Missing' other ='Not Missing';
run;

ODS OUTPUT ONEWAYFREQS=TMP;
proc freq data=fin;
	format _CHAR_ $missfmt.;
	table _CHAR_ / missing missprint nocum NOPERCENT;
	format _NUMERIC_ missfmt.;
	tables _NUMERIC_ / missing missprint nocum NOPERCENT;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would also like to know whether it is more efficient to write my own sql query or simply use the proc freq for it (the data set is huge: ~75 mil rows and 100 variables).&lt;/P&gt;&lt;P&gt;Any suggestion how to get the result I am after? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 21:26:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406161#M279280</guid>
      <dc:creator>Uknown_user</dc:creator>
      <dc:date>2017-10-20T21:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: Re-arranging output of proc freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406189#M279281</link>
      <description>&lt;P&gt;I believe that proc freq is the most efficient tool to get the wanted output.&lt;/P&gt;
&lt;P&gt;You can add the OUTPUT option to get the output into a sas dataset, then&lt;/P&gt;
&lt;P&gt;you can create your own report in a desired format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=fin;
	format _CHAR_ $missfmt.;
	table _CHAR_ / missing missprint nocum NOPERCENT;
	format _NUMERIC_ missfmt.;
	tables _NUMERIC_ / missing missprint nocum NOPERCENT;
  
       OUTPUT OUT=&amp;lt;dataset name&amp;gt;;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Oct 2017 23:52:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406189#M279281</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-10-20T23:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Re-arranging output of proc freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406194#M279282</link>
      <description>&lt;P&gt;The code below creates a summary data set for reports with percentages. It should give you the idea on how to modify your own process, you can switch the variables to be the count variable you're interested in.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/statgeek/2de1faf1644dc8160fe721056202f111" target="_blank"&gt;https://gist.github.com/statgeek/2de1faf1644dc8160fe721056202f111&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Oct 2017 00:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406194#M279282</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-21T00:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Re-arranging output of proc freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406222#M279283</link>
      <description>&lt;P&gt;Thanks, will take a look at it.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Oct 2017 09:52:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406222#M279283</guid>
      <dc:creator>Uknown_user</dc:creator>
      <dc:date>2017-10-21T09:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Re-arranging output of proc freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406229#M279284</link>
      <description>&lt;PRE&gt;
That would be a lot easy for SQL.

data test;
do i = 1 to 100;
output;
end;
run;

data test1;
b = .;
run;

data test2;
c = '';
D = '';
run;

data fin;
set test test1 test2;
run;

data _null_;
 set sashelp.vcolumn(where=(libname='WORK' and memname='FIN')) end=last;
 if _n_=1 then call execute('proc sql; ');
 call execute(catt('select "',name,'" as variable length=40,count(*) as nobs,',
 ' nmiss(',name,') as nmissing from WORK.FIN'));
 if last then call execute(';quit;');
  else call execute('union');
run;


&lt;/PRE&gt;</description>
      <pubDate>Sat, 21 Oct 2017 12:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-output-of-proc-freq/m-p/406229#M279284</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-10-21T12:18:27Z</dc:date>
    </item>
  </channel>
</rss>

