<?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: Geometric Mean , CI and  % CV in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/424653#M22329</link>
    <description>&lt;P&gt;A dataset option RENAME will change the name of the variable such as&lt;/P&gt;
&lt;PRE&gt;ods output geometricmeans=geometricmeans(rename=(u1sideclgm=_ugmclm));&lt;/PRE&gt;
&lt;P&gt;But you will need to know what the default variable name is to rename it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jan 2018 18:22:08 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-01-03T18:22:08Z</dc:date>
    <item>
      <title>Geometric Mean , CI and  % CV</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/424610#M22321</link>
      <description>&lt;P&gt;Hello ALL,&lt;/P&gt;&lt;P&gt;I have this dataset called 'have':&lt;/P&gt;&lt;P&gt;id var1 trt avisit&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 45&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp;&amp;nbsp;baseline&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 43&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; visit2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 43&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; baseline&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1 41&amp;nbsp; &amp;nbsp; &amp;nbsp;B &amp;nbsp;visit2&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 48&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; baseline&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 49&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; visit2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 55&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; baseline&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 83&amp;nbsp; &amp;nbsp; &amp;nbsp;B &amp;nbsp;visit2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3 43&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; baseline&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3 41&amp;nbsp; &amp;nbsp; &amp;nbsp;B&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;visit2&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3 58&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; baseline&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3 69&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp;&amp;nbsp;visit2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;What I want to get is the table in the attached file using proc surveymeans.&lt;/P&gt;&lt;P&gt;I tried with this code but it doesn't work (PS: I didn't continue with relative change ... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&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=" language-sas"&gt;proc surveymeans data=have  geomean UGMCLM LGMCLM CV  ;
var avallg;/* this variable is a log-transformed variable so it's the log of the variable var1  */
class trt avisit; 
ods output statistics=want  n=_n  geomean=_geomean UGMCLM=_UGMCLM  LGMCLM=_LGMCLM CV=_CV ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any suggestion please ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 16:25:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/424610#M22321</guid>
      <dc:creator>oussema</dc:creator>
      <dc:date>2018-01-03T16:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Geometric Mean , CI and  % CV</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/424614#M22323</link>
      <description>&lt;P&gt;I think you're mixing the OUTPUT OUT statement from PROC MEANS with the ODS OUTPUT statement. They operate quite differently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;surveymeans&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;have  &lt;SPAN class="token function"&gt;geomean&lt;/SPAN&gt; UGMCLM LGMCLM &lt;SPAN class="token function"&gt;CV&lt;/SPAN&gt;  &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;var&lt;/SPAN&gt; avallg&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token comment"&gt;/* this variable is a log-transformed variable so it's the log of the variable var1  */&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;class&lt;/SPAN&gt; trt avisit&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
&lt;SPAN class="token statement"&gt;ods&lt;/SPAN&gt; output statistics&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;want &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As far as I can see, there's no OUTPUT statement for PROC SURVEYMEANS and the ODS OUTPUT doesn't allow you to change names in the same step, you'll need to do that in another step.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 16:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/424614#M22323</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-03T16:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Geometric Mean , CI and  % CV</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/424621#M22325</link>
      <description>&lt;P&gt;Make sure to request the right output table.&amp;nbsp; You can use ODS TRACE ON to see in the log the names of the outputs that your code generates. Or you can look at the manual.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_surveymeans_details75.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_surveymeans_details75.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Let's try it with your sample data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
 input id var1 trt $ avisit $ ;
 avallg=log(var1);
cards;
1 45     A  baseline
1 43     A  visit2
1 43     B  baseline
1 41     B  visit2
2 48     A  baseline
2 49     A  visit2
2 55     B  baseline
2 83     B  visit2
3 43     A  baseline
3 41     B  visit2
3 58     B  baseline
3 69     B  visit2
;
proc surveymeans data=have  geomean UGMCLM LGMCLM CV  ;
  var avallg;
  class trt avisit;
ods output summary=summary;
ods output statistics=statistics ;
ods output summaryPanel=summarypanel;
ods output geometricmeans=geometricmeans;
run;
data want ;
  merge summary (where=(Label1='Number of Observations'))
        statistics
        geometricmeans
  ;
  rename nValue1=_n geomean=_geomean u1sideclgm=_ugmclm l1sideclgm=_lgmclm cv=_cv ;
  drop label1 cvalue1 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;                    Var
Obs            _n   Name            _cv      _geomean      GMStdErr       _ugmclm       _lgmclm

 1      12.000000  avallg      0.016505      3.911113      0.062776      4.025492      3.799985&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2018 17:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/424621#M22325</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-03T17:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Geometric Mean , CI and  % CV</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/424653#M22329</link>
      <description>&lt;P&gt;A dataset option RENAME will change the name of the variable such as&lt;/P&gt;
&lt;PRE&gt;ods output geometricmeans=geometricmeans(rename=(u1sideclgm=_ugmclm));&lt;/PRE&gt;
&lt;P&gt;But you will need to know what the default variable name is to rename it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 18:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/424653#M22329</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-03T18:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Geometric Mean , CI and  % CV</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/425332#M22363</link>
      <description>&lt;P&gt;Assuming that your response is lognormal, you could get the geometric mean estimates and your "relative change" estimates, by fitting a normal model to the log-transformed response and then use the &lt;A href="http://support.sas.com/kb/58775" target="_self"&gt;NLEstimate macro&lt;/A&gt;. For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc genmod data=have; 
class trt avisit; 
model avallg=trt*avisit/noint; 
store g;
run;
%nlestimate(instore=g, label=geoAbase, f=exp(b_p1), df=1e4)
%nlestimate(instore=g, label=geoAvisit2, f=exp(b_p2), df=1e4)
%nlestimate(instore=g, label=geoBbase, f=exp(b_p3), df=1e4)
%nlestimate(instore=g, label=geoBvisit2, f=exp(b_p4), df=1e4)
%nlestimate(instore=g, label=geoAbase, f=exp(b_p1), df=1e4)
%nlestimate(instore=g, label=RC A, f=exp(b_p2)-exp(b_p1), df=1e4)
%nlestimate(instore=g, label=RC B, f=exp(b_p4)-exp(b_p3), df=1e4)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The large df= value is used to get large sample confidence intervals.&amp;nbsp; The delta method is used to compute the confidence limits. See the macro documentation for how to use the macro and additional examples of its use for estimating linear or nonlinear functions of model parameters.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A simpler alternative to get just the geometric mean estimates is to use LSMEANS in GENMOD. This uses a different method to compute the limits. See the exponentiated results in the LSMEANS table.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc genmod data=have; 
class trt avisit; 
model avallg=trt|avisit; 
lsmeans trt*avisit / exp cl;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jan 2018 20:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Geometric-Mean-CI-and-CV/m-p/425332#M22363</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2018-01-05T20:27:53Z</dc:date>
    </item>
  </channel>
</rss>

