<?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: How to customize template Stat.Glimmix.LSMeans? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-customize-template-Stat-Glimmix-LSMeans/m-p/646226#M24055</link>
    <description>&lt;P&gt;Show use the Proc code you are currently using.&lt;/P&gt;
&lt;P&gt;Likely you want an ODS OUTPUT statement to send the result of a table to a data set.&lt;/P&gt;
&lt;P&gt;The ODS trace shows the names of the tables your code uses:&lt;/P&gt;
&lt;P&gt;It will be a couple step process. First you run code like this pseudo code:&lt;/P&gt;
&lt;PRE&gt;ods trace on;
proc anyproc data=yourdata;
&amp;lt;proc statements&amp;gt;
run;
ods trace off;&lt;/PRE&gt;
&lt;P&gt;Then look in the LOG for the table names used. OR if you can read SAS documentation the Details section of most procs documentation will have a section named "ODS Table Names" that will show the table name and the option used in the code to generate the table.&lt;/P&gt;
&lt;P&gt;Using that information you RERUN the proc code with the ODS OUTPUT statement(s) you want.&lt;/P&gt;
&lt;PRE&gt;proc anyproc data=yourdata;
ods output aresulttable = myresultdataset;
&amp;lt;proc statements&amp;gt;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 May 2020 14:39:37 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-05-08T14:39:37Z</dc:date>
    <item>
      <title>How to customize template Stat.Glimmix.LSMeans?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-customize-template-Stat-Glimmix-LSMeans/m-p/646101#M24049</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to rearrange only the estimates and standard errors given by the Stat.Glimmix.LSMeans template as depicted below.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;trt Least Squares Means (original)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;trt&lt;/TD&gt;&lt;TD&gt;estimate&lt;/TD&gt;&lt;TD&gt;standard error&lt;/TD&gt;&lt;TD&gt;etc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2.5&lt;/TD&gt;&lt;TD&gt;0.32&lt;/TD&gt;&lt;TD&gt;etc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;0.32&lt;/TD&gt;&lt;TD&gt;etc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;trt Least Squares Means (goal)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;estimate&lt;/TD&gt;&lt;TD&gt;stderr&lt;/TD&gt;&lt;TD&gt;estimate&lt;/TD&gt;&lt;TD&gt;stderr&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.5&lt;/TD&gt;&lt;TD&gt;0.32&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;0.32&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Initially, I thought learning how to use PROC TEMPLATE would solve my problem. After spending the time to understand how PROC TEMPLATE works, I realized that I need to have the estimates and standard errors in a dataset first, at least that's what I think I need to do first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using output with pred and stderr in my Glimmix procedure, but that did not give me the above values in the output dataset I created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, I read about ODS TRACE in a thread here and learned about Stat.Glimmix.LSMeans and its parent Stat.Glimmix.tTests. This is where I am not sure how to proceed. Am I heading in the right direction? Or, am I unaware of another more efficient way to achieve my goal?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 05:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-customize-template-Stat-Glimmix-LSMeans/m-p/646101#M24049</guid>
      <dc:creator>zzstudent20</dc:creator>
      <dc:date>2020-05-08T05:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize template Stat.Glimmix.LSMeans?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-customize-template-Stat-Glimmix-LSMeans/m-p/646226#M24055</link>
      <description>&lt;P&gt;Show use the Proc code you are currently using.&lt;/P&gt;
&lt;P&gt;Likely you want an ODS OUTPUT statement to send the result of a table to a data set.&lt;/P&gt;
&lt;P&gt;The ODS trace shows the names of the tables your code uses:&lt;/P&gt;
&lt;P&gt;It will be a couple step process. First you run code like this pseudo code:&lt;/P&gt;
&lt;PRE&gt;ods trace on;
proc anyproc data=yourdata;
&amp;lt;proc statements&amp;gt;
run;
ods trace off;&lt;/PRE&gt;
&lt;P&gt;Then look in the LOG for the table names used. OR if you can read SAS documentation the Details section of most procs documentation will have a section named "ODS Table Names" that will show the table name and the option used in the code to generate the table.&lt;/P&gt;
&lt;P&gt;Using that information you RERUN the proc code with the ODS OUTPUT statement(s) you want.&lt;/P&gt;
&lt;PRE&gt;proc anyproc data=yourdata;
ods output aresulttable = myresultdataset;
&amp;lt;proc statements&amp;gt;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 14:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-customize-template-Stat-Glimmix-LSMeans/m-p/646226#M24055</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-08T14:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize template Stat.Glimmix.LSMeans?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-customize-template-Stat-Glimmix-LSMeans/m-p/647286#M24083</link>
      <description>&lt;P&gt;Hi ballardw,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the suggestions! My apologies for the delayed response. I am using SAS 9.4 on Windows 10 and below is the PROC code I am currently using that includes ODS TRACE and my DATA step. Unfortunately, your suggestions did not work in my case. Of course, I could have followed your suggestions incorrectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options center nonumber; options ls=99; options ps=66;
data data;
title 'Code with Random Data';
input year block trt va rep PH;
cards;
1	1	1	1	1	2.82
1	1	1	1	2	3.311
1	1	1	1	3	1.944
1	1	1	1	4	2.048
1	1	1	2	1	2.789
1	1	1	2	2	3.413
1	1	1	2	3	3.818
1	1	1	2	4	3.812
1	1	1	3	1	5.493
1	1	1	3	2	2.266
1	1	1	3	3	3.437
1	1	1	3	4	1.471
1	1	1	5	1	2.037
1	1	1	5	2	1.873
1	1	1	5	3	1.463
1	1	1	5	4	2.983
1	1	1	6	1	2.802
1	1	1	6	2	2.013
1	1	1	6	3	2.646
1	1	1	6	4	2.399
1	1	2	1	1	4.512
1	1	2	1	2	2.892
1	1	2	1	3	4.57
1	1	2	1	4	2.865
1	1	2	2	1	3.373
1	1	2	2	2	3.293
1	1	2	2	3	3.782
1	1	2	2	4	3.881
1	1	2	3	1	2.678
1	1	2	3	2	2.257
1	1	2	3	3	4.786
1	1	2	3	4	5.43
1	1	2	5	1	2.123
1	1	2	5	2	4.372
1	1	2	5	3	1.964
1	1	2	5	4	1.824
1	1	2	6	1	1.766
1	1	2	6	2	1.387
1	1	2	6	3	3.151
1	1	2	6	4	2.495
1	2	1	1	1	4.387
1	2	1	1	2	2.369
1	2	1	1	3	1.587
1	2	1	1	4	1.813
1	2	1	2	1	3.824
1	2	1	2	2	1.835
1	2	1	2	3	1.482
1	2	1	2	4	2.569
1	2	1	3	1	3.522
1	2	1	3	2	2.279
1	2	1	3	3	2.212
1	2	1	3	4	2.225
1	2	1	5	1	4.254
1	2	1	5	2	2.072
1	2	1	5	3	4.01
1	2	1	5	4	2.337
1	2	1	6	1	2.022
1	2	1	6	2	1.464
1	2	1	6	3	1.38
1	2	1	6	4	1.436
1	2	2	1	1	2.2
1	2	2	1	2	2.947
1	2	2	1	3	2.035
1	2	2	1	4	2.015
1	2	2	2	1	3.015
1	2	2	2	2	4.212
1	2	2	2	3	3.747
1	2	2	2	4	1.815
1	2	2	3	1	4.227
1	2	2	3	2	4.056
1	2	2	3	3	3.857
1	2	2	3	4	3.24
1	2	2	5	1	4.568
1	2	2	5	2	6.188
1	2	2	5	3	2.12
1	2	2	5	4	2.257
1	2	2	6	1	2.022
1	2	2	6	2	4.509
1	2	2	6	3	2.353
1	2	2	6	4	3.479
2	1	1	1	1	6.099
2	1	1	1	2	5.531
2	1	1	1	3	3.535
2	1	1	1	4	2.714
2	1	1	2	1	2.641
2	1	1	2	2	2.751
2	1	1	2	3	3.583
2	1	1	2	4	2.592
2	1	1	3	1	2.471
2	1	1	3	2	3.074
2	1	1	3	3	7.628
2	1	1	3	4	3.825
2	1	1	5	1	3.442
2	1	1	5	2	3.406
2	1	1	5	3	3.501
2	1	1	5	4	2.908
2	1	1	6	1	2.861
2	1	1	6	2	2.392
2	1	1	6	3	2.528
2	1	1	6	4	2.723
2	1	2	1	1	2.374
2	1	2	1	2	2.904
2	1	2	1	3	3.026
2	1	2	1	4	3.451
2	1	2	2	1	4.136
2	1	2	2	2	1.813
2	1	2	2	3	1.422
2	1	2	2	4	4.25
2	1	2	3	1	3.056
2	1	2	3	2	1.911
2	1	2	3	3	3.839
2	1	2	3	4	3.195
2	1	2	5	1	3.042
2	1	2	5	2	2.301
2	1	2	5	3	4.185
2	1	2	5	4	3.577
2	1	2	6	1	2.213
2	1	2	6	2	3.729
2	1	2	6	3	2.214
2	1	2	6	4	3.043
2	2	1	1	1	2.106
2	2	1	1	2	3.312
2	2	1	1	3	2.577
2	2	1	1	4	3.929
2	2	1	2	1	2.771
2	2	1	2	2	2.94
2	2	1	2	3	3.281
2	2	1	2	4	2.244
2	2	1	3	1	1.839
2	2	1	3	2	3.49
2	2	1	3	3	2.117
2	2	1	3	4	2.335
2	2	1	5	1	3.508
2	2	1	5	2	5.813
2	2	1	5	3	3.762
2	2	1	5	4	4.858
2	2	1	6	1	3.72
2	2	1	6	2	5.405
2	2	1	6	3	3.614
2	2	1	6	4	3.537
2	2	2	1	1	2.108
2	2	2	1	2	6.027
2	2	2	1	3	2.061
2	2	2	1	4	1.467
2	2	2	2	1	2.682
2	2	2	2	2	1.872
2	2	2	2	3	4.446
2	2	2	2	4	2.54
2	2	2	3	1	2.29
2	2	2	3	2	1.803
2	2	2	3	3	2.698
2	2	2	3	4	0.68
2	2	2	5	1	3.065
2	2	2	5	2	1.015
2	2	2	5	3	4.453
2	2	2	5	4	6.485
2	2	2	6	1	3.403
2	2	2	6	2	1.808
2	2	2	6	3	2.158
2	2	2	6	4	1.456
;

proc sort; by va year block trt;
proc means noprint; by va year block trt;
var PH;
output out=meandata mean=PH;
run;

ods trace on;

proc glimmix data=meandata nobound;by va;
class year block trt;
model PH = trt year trt*year /ddfm=satterth;
random block ;
lsmeans trt/pdiff lines cl;
run;

ods trace off;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ODS TRACE shows that the name of the table template that contains the estimates and standard errors that I need to extract is Stat.Glimmix.LSMeans.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Output Added:
-------------
Name:       LSMeans
Label:      trt LS-Means
Template:   Stat.Glimmix.LSMeans
Path:       Glimmix.ByGroup5.LSMeans.LSMeans&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, using 'Pred' and 'StdErr' based on the info provided in &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_glimmix_syntax19.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;Table 49.15:Keywords for Output Statistics&lt;/A&gt; in the SAS Documentation for GLIMMIX does not yield the same estimates and standard errors I get in the Stat.Glimmix.LSMeans table. Below is the the code with the OUTPUT STATEMENT and PROC TEMPLATE code to visualize the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glimmix data=meandata nobound;by va;
class year block trt;
model PH = trt year trt*year /ddfm=satterth;
random block ;
lsmeans trt/pdiff lines cl;
output out=test pred=p stderr=se;
run;

###Output Data in Table Format###
proc template;
	define table mytable;
	end;
run;

data _null_;
	set test;
	file print ods = (template='mytable');
	put _ods_;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I try to use Stat.Glimmix.LSMeans in the OUTPUT STATEMENT, I get "ERROR:Statement is not valid or it is used out of proper order." My code is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glimmix data=meandata nobound;by va;
class year block trt;
model PH = trt year trt*year /ddfm=satterth;
random block ;
lsmeans trt/pdiff lines cl;
output Stat.Glimmix.LSMeans=myresults;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Unless the Table 49.15 is not the correct table, I am not sure what else to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 01:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-customize-template-Stat-Glimmix-LSMeans/m-p/647286#M24083</guid>
      <dc:creator>zzstudent20</dc:creator>
      <dc:date>2020-05-13T01:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to customize template Stat.Glimmix.LSMeans?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-customize-template-Stat-Glimmix-LSMeans/m-p/647616#M24087</link>
      <description>My friend pointed out that I forgot "ODS" in my output statement. Doing that and using LSMeans=myresults gave me the data set I need. Problem solved.</description>
      <pubDate>Wed, 13 May 2020 20:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-customize-template-Stat-Glimmix-LSMeans/m-p/647616#M24087</guid>
      <dc:creator>zzstudent20</dc:creator>
      <dc:date>2020-05-13T20:41:48Z</dc:date>
    </item>
  </channel>
</rss>

