<?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: Conditional summary using PROC MEANS in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS/m-p/532186#M5992</link>
    <description>&lt;P&gt;If your variables are numeric and coded 0/1 then requesting the SUM will give you a count of the number of records with a value of 1.&lt;/P&gt;
&lt;P&gt;If you request a Mean then that is a percentage of 1's.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc means data= zzz nway noprint;
   class dv1 dv2 dv3... dv30;
   output out= aaa sum= ;
run;
&lt;/PRE&gt;
&lt;P&gt;will have the variables with a sum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Feb 2019 20:23:54 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-02-01T20:23:54Z</dc:date>
    <item>
      <title>Conditional summary using PROC MEANS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS/m-p/532184#M5990</link>
      <description>&lt;P&gt;I have a dataset which has about 30 dummy variables. I need to show the frequency of all the dummy variables having 1. If I want to achieve this by PROC MEANS, how can I do so? Is there any better way? The idea is to have the following logic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if dv1=1, dv2=1, dv3=1... dv30=1 then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc means data= zzz nway noprint;&lt;/P&gt;&lt;P&gt;class dv1 dv2 dv3... dv30;&lt;/P&gt;&lt;P&gt;output out= aaa;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The imaginary dataset is like the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input dv1 dv2 dv3;
datalines;
1 0 1
0 0 1
1 0 0
0 1 1
0 0 1
1 1 0
0 0 0
1 0 0
0 1 0
0 0 1
0 0 0
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Much thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 20:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS/m-p/532184#M5990</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2019-02-01T20:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional summary using PROC MEANS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS/m-p/532185#M5991</link>
      <description>&lt;P&gt;Are you asking for this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*show the frequency of all the dummy variables having 1.*/

data have;
  input dv1 dv2 dv3;
datalines;
1 0 1
0 0 1
1 0 0
0 1 1
0 0 1
1 1 0
0 0 0
1 0 0
0 1 0
0 0 1
0 0 0
run;

proc means data= have nway noprint;

var  dv1-dv3;

output out= aaa(drop=_:) sum=/autoname;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Feb 2019 20:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS/m-p/532185#M5991</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-02-01T20:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional summary using PROC MEANS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS/m-p/532186#M5992</link>
      <description>&lt;P&gt;If your variables are numeric and coded 0/1 then requesting the SUM will give you a count of the number of records with a value of 1.&lt;/P&gt;
&lt;P&gt;If you request a Mean then that is a percentage of 1's.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc means data= zzz nway noprint;
   class dv1 dv2 dv3... dv30;
   output out= aaa sum= ;
run;
&lt;/PRE&gt;
&lt;P&gt;will have the variables with a sum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 20:23:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS/m-p/532186#M5992</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-02-01T20:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional summary using PROC MEANS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS/m-p/532191#M5994</link>
      <description>Thank you so much. Exactly this is what I have been looking for.</description>
      <pubDate>Fri, 01 Feb 2019 20:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS/m-p/532191#M5994</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2019-02-01T20:37:32Z</dc:date>
    </item>
  </channel>
</rss>

