<?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 Part 2 in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS-Part-2/m-p/532442#M6024</link>
    <description>Would you please tell me how I can do this using PROC FREQ? I didn't have the idea about using it. The only other way I could figure out was PROC SQL which for some reasons I cannot use.&lt;BR /&gt;&lt;BR /&gt;Much thanks.</description>
    <pubDate>Sun, 03 Feb 2019 19:42:30 GMT</pubDate>
    <dc:creator>d6k5d3</dc:creator>
    <dc:date>2019-02-03T19:42:30Z</dc:date>
    <item>
      <title>Conditional summary using PROC MEANS Part 2</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS-Part-2/m-p/532363#M6017</link>
      <description>&lt;P&gt;I have the following dataset:&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  dv4;
datalines;
1 0 1 0
0 0 1 -1
1 -1 0 0
0 1 1 1
0 0 1 -1
1 1 0 0
0 0 0 0
1 0 1 1
0 0 1 1
1 1 1 0
1 0 0 0
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Using PROC MEANS I want to know the following frequencies:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dv2&amp;gt;0&lt;/P&gt;&lt;P&gt;dv2&amp;lt;0&lt;/P&gt;&lt;P&gt;dv4&amp;gt;0&lt;/P&gt;&lt;P&gt;dv4&amp;lt;0&lt;/P&gt;&lt;P&gt;dv2= 0 when dv1= 1&lt;/P&gt;&lt;P&gt;dv4= 0 when dv3= 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I get them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much thanks again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Feb 2019 08:53:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS-Part-2/m-p/532363#M6017</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2019-02-03T08:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional summary using PROC MEANS Part 2</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS-Part-2/m-p/532371#M6019</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/239423"&gt;@d6k5d3&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have the following dataset:&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  dv4;
datalines;
1 0 1 0
0 0 1 -1
1 -1 0 0
0 1 1 1
0 0 1 -1
1 1 0 0
0 0 0 0
1 0 1 1
0 0 1 1
1 1 1 0
1 0 0 0
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Using PROC MEANS I want to know the following frequencies:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dv2&amp;gt;0&lt;/P&gt;
&lt;P&gt;dv2&amp;lt;0&lt;/P&gt;
&lt;P&gt;dv4&amp;gt;0&lt;/P&gt;
&lt;P&gt;dv4&amp;lt;0&lt;/P&gt;
&lt;P&gt;dv2= 0 when dv1= 1&lt;/P&gt;
&lt;P&gt;dv4= 0 when dv3= 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I get them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It has to be PROC MEANS? You can't use a more appropriate tool like PROC FREQ? In PROC FREQ, the answer is easy. Why make extra work by forcing a tool like PROC MEANS to do something that it wasn't designed to do?????&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see Maxim 14&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Feb 2019 13:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS-Part-2/m-p/532371#M6019</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-02-03T13:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional summary using PROC MEANS Part 2</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS-Part-2/m-p/532408#M6021</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/239423"&gt;@d6k5d3&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value sign
low-&amp;lt;0  = '&amp;lt;0'
0       = ' 0'
0&amp;lt;-high = '&amp;gt;0';
run;

proc means data=have noprint;
format dv2 dv4 sign.;
class dv4 dv2 dv1 dv3;
types dv4 dv2 dv2*dv1 dv4*dv3;
output out=want;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The output contains the requested counts (highlighted below):&lt;/P&gt;
&lt;PRE&gt;dv4    dv2    dv1    dv3    _TYPE_    _FREQ_

 .     &amp;lt;0      .      .        4         &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/FONT&gt;
 .      0      .      .        4         7
 .     &amp;gt;0      .      .        4         &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;
 .     &amp;lt;0      1      .        6         1
 .      0      0      .        6         4
 .      0      1      .        6         &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;
 .     &amp;gt;0      0      .        6         1
 .     &amp;gt;0      1      .        6         2
&amp;lt;0      .      .      .        8         &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/FONT&gt;
 0      .      .      .        8         6
&amp;gt;0      .      .      .        8         &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;
&amp;lt;0      .      .      1        9         2
 0      .      .      0        9         4
 0      .      .      1        9         &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/FONT&gt;
&amp;gt;0      .      .      1        9         3&lt;/PRE&gt;</description>
      <pubDate>Sun, 03 Feb 2019 15:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS-Part-2/m-p/532408#M6021</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-02-03T15:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional summary using PROC MEANS Part 2</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS-Part-2/m-p/532442#M6024</link>
      <description>Would you please tell me how I can do this using PROC FREQ? I didn't have the idea about using it. The only other way I could figure out was PROC SQL which for some reasons I cannot use.&lt;BR /&gt;&lt;BR /&gt;Much thanks.</description>
      <pubDate>Sun, 03 Feb 2019 19:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conditional-summary-using-PROC-MEANS-Part-2/m-p/532442#M6024</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2019-02-03T19:42:30Z</dc:date>
    </item>
  </channel>
</rss>

