<?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: calculate the frequency of positive and negative values by id in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737256#M80449</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id variation ;
cards;
1     0.258
1      -0.53
2       0.563
2       -0.386
2     -0.568
;

data temp;
 set have;
 sign=sign(variation);
run;
proc freq data=temp noprint;
table id*sign/list out=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 27 Apr 2021 13:08:25 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-04-27T13:08:25Z</dc:date>
    <item>
      <title>calculate the frequency of positive and negative values by id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737015#M80442</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this table&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id variation&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;0.258&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; -0.53&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.563&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-0.386&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;-0.568&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to calculate the number of negative and positive variations by id. the table that I want&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id variation count&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;positive&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;negatif&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp;positive&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp;negatif&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 15:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737015#M80442</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2021-04-26T15:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the frequency of positive and negative values by id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737016#M80443</link>
      <description>&lt;P&gt;Use a format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value pos_neg_fmt
low - 0 = 'Negative'
0 - high = 'Positive';
run;

proc freq data=have;
table ID*Variation / list;
format variation pos_neg_fmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4327"&gt;@sasphd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this table&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id variation&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;0.258&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; -0.53&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.563&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-0.386&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;-0.568&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to calculate the number of negative and positive variations by id. the table that I want&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id variation count&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;positive&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;negatif&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp;positive&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp;negatif&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 15:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737016#M80443</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-26T15:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the frequency of positive and negative values by id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737026#M80444</link>
      <description>&lt;P&gt;Thank you very much Reeza.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How I can do a z-test to test if the proportion of positive variation is equal between id 1 and 2?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 15:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737026#M80444</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2021-04-26T15:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the frequency of positive and negative values by id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737027#M80445</link>
      <description>PROC TTEST or PROC ANOVA</description>
      <pubDate>Mon, 26 Apr 2021 15:55:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737027#M80445</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-26T15:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the frequency of positive and negative values by id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737030#M80446</link>
      <description>&lt;P&gt;please can you give the program pour z-test with Anova or ttest&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 16:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737030#M80446</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2021-04-26T16:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the frequency of positive and negative values by id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737041#M80447</link>
      <description>&lt;P&gt;Just for completeness, where should exactly zero values fit?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 16:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737041#M80447</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-26T16:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the frequency of positive and negative values by id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737042#M80448</link>
      <description>&lt;P&gt;in positive!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 16:22:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737042#M80448</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2021-04-26T16:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the frequency of positive and negative values by id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737256#M80449</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id variation ;
cards;
1     0.258
1      -0.53
2       0.563
2       -0.386
2     -0.568
;

data temp;
 set have;
 sign=sign(variation);
run;
proc freq data=temp noprint;
table id*sign/list out=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Apr 2021 13:08:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737256#M80449</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-04-27T13:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the frequency of positive and negative values by id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737259#M80450</link>
      <description>&lt;P&gt;I think should use Relative Risk . since it is really a contingency table.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; wrote a blog about it before.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/07/05/test-equality-two-proportions-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2017/07/05/test-equality-two-proportions-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2015/10/26/exact-tests-proc-freq.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2015/10/26/exact-tests-proc-freq.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2015/08/21/she-ranger.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2015/08/21/she-ranger.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
input id variation ;
cards;
1     0.258
1      -0.53
2       0.563
2       -0.386
2     -0.568
;

data temp;
 set have;
 sign=sign(variation);
run;
proc freq data=temp noprint;
table id*sign/list out=want;
run;


proc freq data=want;
table id*sign/relrisk riskdiff chisq;
weight count;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 12:20:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-frequency-of-positive-and-negative-values-by-id/m-p/737259#M80450</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-04-28T12:20:36Z</dc:date>
    </item>
  </channel>
</rss>

