<?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: Report of freq of multiple univaraite varaibles in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Report-of-freq-of-multiple-univaraite-varaibles/m-p/710155#M218557</link>
    <description>&lt;P&gt;First thing: your Input statement tries to read 9 variables. You only provide values for 7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, fill in some example values in the result. The datamay need to be reshaped to make a table of that form because to have a separate column for "VAR" and "Category" requires additional variables. And how the reshape goes will be affected by what the ID variable does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This may get you close:&lt;/P&gt;
&lt;PRE&gt;Proc tabulate data=ttt;
   class x w y z q;
   var ind;
   table x w y z q,
         ind *(n='nr obs' sum='nr fail obs'*f=best5. mean='pct fail'*f=percent8.1)
         /nocellmerge
   ;
run;&lt;/PRE&gt;
&lt;P&gt;But tabulate needs another variable(s) to make the first column and the options to create and color a blank line adding even more data to have something to indicate the colors for the cell, borders and such based on value and using formats to indicate what color.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jan 2021 12:50:35 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-01-08T12:50:35Z</dc:date>
    <item>
      <title>Report of freq of multiple univaraite varaibles</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-of-freq-of-multiple-univaraite-varaibles/m-p/710142#M218548</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to calculate for each varaible (from a list of varaibles):&lt;/P&gt;
&lt;P&gt;(1)-number of observations in each category&lt;/P&gt;
&lt;P&gt;(2)-number of observations in each category that fail(fail is ind=1)&lt;/P&gt;
&lt;P&gt;(3)-PCT of failure calculated by (1)/(2)&lt;/P&gt;
&lt;P&gt;Required output: (with empty row gap with black&amp;nbsp; background&amp;nbsp; between varaibles)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Required_output.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53302i80530072027E1A50/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Required_output.PNG" alt="Required_output.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data ttt;
input ID x $ w $ y $ z $ q $ r $ t $ ind;
cards;
1 x1 w2 y2 z3 q1 0
2 x2 w2 y1 z1 q1 1
3 x1 w1 y1 z2 q2 0
4 x3 w3 y1 z2 q2 0
5 x1 w2 y1 z2 q1 0
6 x1 w1 y2 z1 q2 1
7 x2 w3 y2 z1 q1 0
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV id="tinyMceEditorRonein_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 10:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-of-freq-of-multiple-univaraite-varaibles/m-p/710142#M218548</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-01-08T10:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Report of freq of multiple univaraite varaibles</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-of-freq-of-multiple-univaraite-varaibles/m-p/710155#M218557</link>
      <description>&lt;P&gt;First thing: your Input statement tries to read 9 variables. You only provide values for 7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, fill in some example values in the result. The datamay need to be reshaped to make a table of that form because to have a separate column for "VAR" and "Category" requires additional variables. And how the reshape goes will be affected by what the ID variable does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This may get you close:&lt;/P&gt;
&lt;PRE&gt;Proc tabulate data=ttt;
   class x w y z q;
   var ind;
   table x w y z q,
         ind *(n='nr obs' sum='nr fail obs'*f=best5. mean='pct fail'*f=percent8.1)
         /nocellmerge
   ;
run;&lt;/PRE&gt;
&lt;P&gt;But tabulate needs another variable(s) to make the first column and the options to create and color a blank line adding even more data to have something to indicate the colors for the cell, borders and such based on value and using formats to indicate what color.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 12:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-of-freq-of-multiple-univaraite-varaibles/m-p/710155#M218557</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-08T12:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Report of freq of multiple univaraite varaibles</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-of-freq-of-multiple-univaraite-varaibles/m-p/710373#M218663</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data ttt;
input ID x $ w $ y $ z $ q $ ind;
cards;
1 x1 w2 y2 z3 q1 0
2 x2 w2 y1 z1 q1 1
3 x1 w1 y1 z2 q2 0
4 x3 w3 y1 z2 q2 0
5 x1 w2 y1 z2 q1 0
6 x1 w1 y2 z1 q2 1
7 x2 w3 y2 z1 q1 0
;
run;
proc transpose data=ttt out=temp;
by id ind;
var x w y z q ;
run;

proc report data=temp nowd;
column _name_ col1 n ind=ind_sum ind=ind_mean;
define _name_/group 'var' order=data;
define col1/group 'category';
define n/'Nr_Obs';
define ind_sum/analysis sum 'Nr_Fail_Obs';
define ind_mean/analysis mean 'PCT_Fail' format=percent8.2;
compute before _name_/style={background=verylightgray};
_n+1;len=10;
if _n=1 then len=0;
dummy=' ';
line dummy $varying10. len;
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Doing homework ?&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2021 13:42:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-of-freq-of-multiple-univaraite-varaibles/m-p/710373#M218663</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-01-09T13:42:59Z</dc:date>
    </item>
  </channel>
</rss>

