<?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 Calculating effect size - how to use this macro? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculating-effect-size-how-to-use-this-macro/m-p/805375#M317252</link>
    <description>&lt;P&gt;I came across this macro for calculating various effect size statistics, but I am unsure how to use it. Can someone show me how I would input in my data and run this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, I would like to compute Cohen's d and Hedges' g. My values are the following:&lt;/P&gt;&lt;P&gt;NE = 103&lt;BR /&gt;NC = 100&lt;BR /&gt;ME = 1.44&lt;BR /&gt;MC = 1.43&lt;BR /&gt;SE = 0.65&lt;BR /&gt;SC = 0.59&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%macro compeff(indata,outdata);
/******************************************************/
/*  INDATA: Name of the Input Data Set                */
/*  OUTDATA: Name of the Output Data Set              */
/******************************************************/
data &amp;amp;outdata; set &amp;amp;indata;
/******************************************************/
/* INPUT DATA:                                        */
/*  NE:  Sample size for Experimental Group           */
/*  NC:  Sample size for Control Group                */
/*  ME:  Treatment Effect for Experimental Group      */
/*  MC:  Treatment Effect for Control Group           */
/*  SE:  Standard Deviation for Experimental Group    */
/*  SC:  Standard Deviation for Control Group         */
/*                                                    */
/* OUTPUT DATA:                                       */
/*  TYPE:  0 = Glass' Delta                           */
/*         1 = Cohen's d                              */
/*         2 = Hedges' g                              */
/*         3 = Hedges' gu                             */
/*         4 = Transformed Correlation rpb            */
/*  ESTIMATE: Effect-Szie Estimate                    */
/*  STD: Estimated Standard deviation                 */
/*  LOWER:  Lower Bound of 95% Confidence Interval    */
/*  UPPER:  Upper Bound of 95% Confidence Interval    */
/******************************************************/
   dfd = ne+nc;
   dfg = dfd-2;
/******************************************************/
/*  Compute Glass's Delta                             */
/******************************************************/
   del = (me-mc)/sc;
   vdel = dfd/(ne*nc)+(del*del)/(2*nc-2);
   sdel = sqrt(vdel);
/******************************************************/
/*  Compute Cohen's d                                 */
/******************************************************/
   sm = sqrt(((ne-1)*(se*se)+(nc-1)*(sc*sc))/dfd);
   dd = (me-mc)/sm;
   vdd = dfd/(ne*nc)+0.5*dd*dd/dfg;
   sdd = sqrt(vdd);
/******************************************************/
/*  Compute Hedges' g                                 */
/******************************************************/
   sp = sqrt(((ne-1)*(se*se)+(nc-1)*(sc*sc))/dfg);
   gg = (me-mc)/sp;
   vgg = dfd/(ne*nc)+0.5*gg*gg/dfg;
   sgg = sqrt(vgg);
/******************************************************/
/*  Compute Hedges' gu                                */
/******************************************************/
   corrf=exp(lgamma(0.5*dfg)-lgamma(0.5*(dfg-1))
      -log(sqrt(0.5*dfg)));
   gu = gg * corrf;
   vgu = dfd/(ne*nc)+0.5*gu*gu/dfd;
   sgu = sqrt(vgu);
/*********************************************************/
/*  Compute Point-Biserial Correlation                   */
/*********************************************************/
   rpb = sqrt((ne*nc*dd*dd)/(ne*nc*dd*dd+dfd*dfd));
   zrpb = 0.5*log((1+rpb)/(1-rpb));
   vzrpb = 1 / (dfd-3);
   szrpb = sqrt(vzrpb);
   type = 0;
   estimate = del;
   std = sdel;
   lower = del + probit(0.025) * sdel;
   upper = del + probit(0.975) * sdel;
   output;
   type = 1;
   estimate = dd;
   std = sdd;
   lower = dd + probit(0.025) * sdd;
   upper = dd + probit(0.975) * sdd;
   output;
   type = 2;
   estimate = gg;
   std = sgg;
   lower = gg + probit(0.025) * sgg;
   upper = gg + probit(0.975) * sgg;
   output;
   type = 3;
   estimate = gu;
   std = sgu;
   lower = gu + probit(0.025) * sgu;
   upper = gu + probit(0.975) * sgu;
   output;
   type = 4;
   estimate = rpb;
   std = szrpb;
   lower = zrpb + probit(0.025) * szrpb;
   upper = zrpb + probit(0.975) * szrpb;
   lower = (exp(2*lower)-1)/(exp(2*lower)+1);
   upper = (exp(2*upper)-1)/(exp(2*upper)+1);
   output;
   keep ne nc me mc se sc type estimate lower upper;
%mend compeff;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Mar 2022 18:18:32 GMT</pubDate>
    <dc:creator>DougHold</dc:creator>
    <dc:date>2022-03-31T18:18:32Z</dc:date>
    <item>
      <title>Calculating effect size - how to use this macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-effect-size-how-to-use-this-macro/m-p/805375#M317252</link>
      <description>&lt;P&gt;I came across this macro for calculating various effect size statistics, but I am unsure how to use it. Can someone show me how I would input in my data and run this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, I would like to compute Cohen's d and Hedges' g. My values are the following:&lt;/P&gt;&lt;P&gt;NE = 103&lt;BR /&gt;NC = 100&lt;BR /&gt;ME = 1.44&lt;BR /&gt;MC = 1.43&lt;BR /&gt;SE = 0.65&lt;BR /&gt;SC = 0.59&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%macro compeff(indata,outdata);
/******************************************************/
/*  INDATA: Name of the Input Data Set                */
/*  OUTDATA: Name of the Output Data Set              */
/******************************************************/
data &amp;amp;outdata; set &amp;amp;indata;
/******************************************************/
/* INPUT DATA:                                        */
/*  NE:  Sample size for Experimental Group           */
/*  NC:  Sample size for Control Group                */
/*  ME:  Treatment Effect for Experimental Group      */
/*  MC:  Treatment Effect for Control Group           */
/*  SE:  Standard Deviation for Experimental Group    */
/*  SC:  Standard Deviation for Control Group         */
/*                                                    */
/* OUTPUT DATA:                                       */
/*  TYPE:  0 = Glass' Delta                           */
/*         1 = Cohen's d                              */
/*         2 = Hedges' g                              */
/*         3 = Hedges' gu                             */
/*         4 = Transformed Correlation rpb            */
/*  ESTIMATE: Effect-Szie Estimate                    */
/*  STD: Estimated Standard deviation                 */
/*  LOWER:  Lower Bound of 95% Confidence Interval    */
/*  UPPER:  Upper Bound of 95% Confidence Interval    */
/******************************************************/
   dfd = ne+nc;
   dfg = dfd-2;
/******************************************************/
/*  Compute Glass's Delta                             */
/******************************************************/
   del = (me-mc)/sc;
   vdel = dfd/(ne*nc)+(del*del)/(2*nc-2);
   sdel = sqrt(vdel);
/******************************************************/
/*  Compute Cohen's d                                 */
/******************************************************/
   sm = sqrt(((ne-1)*(se*se)+(nc-1)*(sc*sc))/dfd);
   dd = (me-mc)/sm;
   vdd = dfd/(ne*nc)+0.5*dd*dd/dfg;
   sdd = sqrt(vdd);
/******************************************************/
/*  Compute Hedges' g                                 */
/******************************************************/
   sp = sqrt(((ne-1)*(se*se)+(nc-1)*(sc*sc))/dfg);
   gg = (me-mc)/sp;
   vgg = dfd/(ne*nc)+0.5*gg*gg/dfg;
   sgg = sqrt(vgg);
/******************************************************/
/*  Compute Hedges' gu                                */
/******************************************************/
   corrf=exp(lgamma(0.5*dfg)-lgamma(0.5*(dfg-1))
      -log(sqrt(0.5*dfg)));
   gu = gg * corrf;
   vgu = dfd/(ne*nc)+0.5*gu*gu/dfd;
   sgu = sqrt(vgu);
/*********************************************************/
/*  Compute Point-Biserial Correlation                   */
/*********************************************************/
   rpb = sqrt((ne*nc*dd*dd)/(ne*nc*dd*dd+dfd*dfd));
   zrpb = 0.5*log((1+rpb)/(1-rpb));
   vzrpb = 1 / (dfd-3);
   szrpb = sqrt(vzrpb);
   type = 0;
   estimate = del;
   std = sdel;
   lower = del + probit(0.025) * sdel;
   upper = del + probit(0.975) * sdel;
   output;
   type = 1;
   estimate = dd;
   std = sdd;
   lower = dd + probit(0.025) * sdd;
   upper = dd + probit(0.975) * sdd;
   output;
   type = 2;
   estimate = gg;
   std = sgg;
   lower = gg + probit(0.025) * sgg;
   upper = gg + probit(0.975) * sgg;
   output;
   type = 3;
   estimate = gu;
   std = sgu;
   lower = gu + probit(0.025) * sgu;
   upper = gu + probit(0.975) * sgu;
   output;
   type = 4;
   estimate = rpb;
   std = szrpb;
   lower = zrpb + probit(0.025) * szrpb;
   upper = zrpb + probit(0.975) * szrpb;
   lower = (exp(2*lower)-1)/(exp(2*lower)+1);
   upper = (exp(2*upper)-1)/(exp(2*upper)+1);
   output;
   keep ne nc me mc se sc type estimate lower upper;
%mend compeff;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 18:18:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-effect-size-how-to-use-this-macro/m-p/805375#M317252</guid>
      <dc:creator>DougHold</dc:creator>
      <dc:date>2022-03-31T18:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating effect size - how to use this macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-effect-size-how-to-use-this-macro/m-p/805376#M317253</link>
      <description>&lt;P&gt;You need to create a dataset according to the description in the comment section:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* INPUT DATA:                                        */
/*  NE:  Sample size for Experimental Group           */
/*  NC:  Sample size for Control Group                */
/*  ME:  Treatment Effect for Experimental Group      */
/*  MC:  Treatment Effect for Control Group           */
/*  SE:  Standard Deviation for Experimental Group    */
/*  SC:  Standard Deviation for Control Group         */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data in;
input ne nc me mc se sc;
datalines;
103 100 1.44 1.43 0.65 0.59
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Mar 2022 18:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-effect-size-how-to-use-this-macro/m-p/805376#M317253</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-31T18:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating effect size - how to use this macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-effect-size-how-to-use-this-macro/m-p/805388#M317257</link>
      <description>Perfect, thank you!</description>
      <pubDate>Thu, 31 Mar 2022 19:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-effect-size-how-to-use-this-macro/m-p/805388#M317257</guid>
      <dc:creator>DougHold</dc:creator>
      <dc:date>2022-03-31T19:18:39Z</dc:date>
    </item>
  </channel>
</rss>

