Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Letter annotation for mean separation

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

☑ This topic is **solved**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 09-18-2023 11:34 AM
(750 views)

**Hi, I am working with repeated measurement analysis with two treatment factors and day. The result outputs do not give letter annotation for the mean separation. So I am wondering how to do it since proc glm will work but not proc mixed **

**Data** RM;

set RM;

A_new = A + **1**;

A_sq = sqrt(A_new);

A_log = log(A_new);

**run**;

ods graphics on;

**proc** **sort** data= RM;

by EU Day;

**run**;

**%macro** one(type);

proc mixed data= RM cl plots=residualpanel (conditional) plot=boxplot (conditional); /*Test assumption */

class Block Day Accession Irrigation EU;

model A_log = Accession Day Irrigation Accession*Day Accession*Irrigation Irrigation*Day Accession*Irrigation*Day / ddfm=satterth; /*Satterthwaite ddf are requested.

Without this specification, Proc Mixed may give erroneous ddf for repeated measures,*/

Random Block;

repeated Day / subject=EU type=&type r rcorr;

lsmeans Accession Day Irrigation Accession*Day Accession*Irrigation Irrigation*Day Accession*Irrigation*Day/adjust=Tukey;

**%mend** one; /*"%mend" indicates the end of the macro*/

%** one**(un); /*each time we write "%one" we are calling up the macro and running it with the type of Covariance structure designated in the parenthesis. For example, on this line we are saying, "Run the macro "one" using the unstructured covariance matrix" ("unstructured" means all variances and covariances are estimated separately) */

%** one**(cs);

%** one**(csh);

/*%one(ar(1)); */

/*%one(arh(1)); */

/*%one(toep); */

/*%one(toeph); */

%** one**(ante(

**run**;

ods graphics off;

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

```
%LET type=toeph;
proc mixed data= RM cl plots=residualpanel (conditional) plot=boxplot (conditional);
class Block Day Accession Irrigation EU;
model A_log = Accession Day Irrigation
Accession*Day Accession*Irrigation Irrigation*Day Accession*Irrigation*Day
/ ddfm=satterth;
Random Block;
repeated Day / subject=EU type=&type r rcorr;
lsmeans Accession Day Irrigation
Accession*Day Accession*Irrigation Irrigation*Day Accession*Irrigation*Day
/ adjust=Tukey;
store ABCXYZ / label='PLM: Getting Started';
run;
proc plm restore=ABCXYZ;
lsmeans Accession*Irrigation / lines linestable;
ods output LSMLines=LSMLines;
run;
/* end of program */
```

Koen

15 REPLIES 15

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

You want this?

This is a paper from SUGI 23 (SUGI --> SAS Global Forum --> SAS Explore).

I believe SUGI 23 was in 2003 or so.

A Macro for Converting Mean Separation Output to Letter Groupings in PROC MIXED

Arnold M. Saxton, University of Tennessee Agricultural Experiment Station

Knoxville, Tennessee

https://support.sas.com/resources/papers/proceedings/proceedings/sugi23/Stats/p230.pdf

Koen

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you for the information. I did the extra codes in my code but I got an error showing ! %pdmix612(DIFFSDATASET, LSMEANSDATASET, alpha=0.05, sort=NO, worksize=1); Error; incoccerct5INCLUDE statement will not be executed. There is a syntax error. **WARNING**: Apparent invocation of macro PDMIX612 not resolved.

Do you know what is happening?

Data RM;

set RM;

A_new = A + 1;

A_sq = sqrt(A_new);

A_log = log(A_new);

run;

ods graphics on;

proc sort data= RM;

by EU Day;

run;

%macro one(type);

proc mixed data= RM cl plots=residualpanel (conditional) plot=boxplot (conditional);

class Block Day Accession Irrigation EU;

model A_new = Accession Day Irrigation Accession*Day Accession*Irrigation Irrigation*Day Accession*Irrigation*Day / ddfm=satterth; /*Satterthwaite ddf are requested.

Without this specification, Proc Mixed may give erroneous ddf for repeated measures,*/

Random Block;

repeated Day / subject=EU type=&type r rcorr;

lsmeans Accession Day Irrigation Accession*Day Accession*Irrigation Irrigation*Day Accession*Irrigation*Day/adjust=Tukey pdiff;

/* Save LSMEANS into a dataset (e.g., LSMEANSDATASET) */

make lsmeans out=LSMEANSDATASET noprint;

/* Save pairwise differences into a dataset (e.g., DIFFSDATASET) */

make diffs out=DIFFSDATASET noprint;

run;

/* Include the external macro %pdmix612 and call it to perform letter annotation */

%include A:PDMIX612.SAS;

%pdmix612(DIFFSDATASET, LSMEANSDATASET, alpha=0.05, sort=NO, worksize=1);

%mend one; /*"%mend" indicates the end of the macro*/

%one(un); /*each time we write "%one" we are calling up the macro and running it with the type of Covariance structure designated in the parenthesis. For example, on this line we are saying, "Run the macro "one" using the unstructured covariance matrix" ("unstructured" means all variances and covariances are estimated separately) */

/*%one(ar(1)); */

/*%one(arh(1)); */

/*%one(toep); */

/*%one(toeph); */

%one(ante(1));

run;

ods graphics off;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hello,

The %INCLUDE statement has a wrong syntax

(hence the macro was not compiled and hence does not "exist" for your SAS session) :

Instead of :

`%include A:PDMIX612.SAS;`

you need something like :

`%include 'C:\Users\ABC_XYZ\Downloads\PDMIX612.SAS' / source2;`

BR,

Koen

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Can I know where can I get or download the A:PDMIX612.SAS?

Is it something that I can create or I need to get from somewhere

Is it something that I can create or I need to get from somewhere

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@ngui wrote:

Can I know where can I get or download the A:PDMIX612.SAS?

Is it something that I can create or I need to get from somewhere

Hello,

The paper says (on page 4) :

The macro code pdmix612.sas can be obtained by anonymous FTP from the server SCS1.AG.UTK.EDU.

That will probably no longer work.

You can try to contact the author (if e-mail address still correct).

Moreover you need SAS/IML (SAS module with Interactive Matrix Language)

and maybe SAS/IML is not in your license key.

Maybe you should follow suggestion by @data_null__ and use LINES option in PROC PLM.

BR,

Koen

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I am using SAS9.4 and it is installed on my computer. Will it be the same as SAS/IML?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@ngui wrote:

I am using SAS9.4 and it is installed on my computer. Will it be the same as SAS/IML?

Hello,

PROC GLM and PROC MIXED (and PROC PLM) are part of a SAS 9.4 module called SAS/STAT.

SAS/IML is another SAS module (some MATLAB like thing with a matrix language for linear algebra and matrix operations).

To see whether SAS/IML is in your license key, you need to submit :

`proc setinit; run;`

Then you need to see (something like) this in your LOG-screen :

```
---SAS/IML
14JUL2024 (CPU A)
---SAS/IML Studio
14JUL2024 (CPU A)
```

BR, Koen

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Seems like you might be able to use LINES option with PROC PLM

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Here is doc for PROC PLM.

The PLM procedure performs __ P__ost-fitting (

SAS® 9.4 and SAS® Viya® 3.5 Programming Documentation

SAS/STAT 15.3 User's Guide

The PLM Procedure

LSMEANS Statement

https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_plm_syntax06.htm

Koen

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I am not familiar with PROC PLM. Would you mind helping me check my data set and see whether it will be suitable for PROC PLM?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

This might help.

```
data BlockDesign;
input block a b y @@;
datalines;
1 1 1 56 1 1 2 41
1 2 1 50 1 2 2 36
1 3 1 39 1 3 2 35
2 1 1 30 2 1 2 25
2 2 1 36 2 2 2 28
2 3 1 33 2 3 2 30
3 1 1 32 3 1 2 24
3 2 1 31 3 2 2 27
3 3 1 15 3 3 2 19
4 1 1 30 4 1 2 25
4 2 1 35 4 2 2 30
4 3 1 17 4 3 2 18
;
proc mixed data=BlockDesign;
class block a b;
model y = a b a*b / solution;
random block;
store BlockAnalysis / label='PLM: Getting Started';
run;
ods trace on;
proc plm restore=blockanalysis;
lsmeans a*b / lines linestable;
ods output LSMLines=LSMLines;
run;
ods trace off;
proc contents varnum;
proc print;
run;
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hello,

Here's an example with PROC GLIMMIX (instead of PROC MIXED).

The crucial part is the STORE statement:

```
proc glimmix data=multicenter;
class center group;
model sideeffect/n = group / solution;
random intercept / subject=center;
store gmx;
run;
proc plm source=gmx;
lsmeans group / cl ilink;
run;
```

gmx is the name of the item store.

Using item stores and PROC PLM enables you to perform separate common post-processing tasks, CONTRASTS, ESTIMATES, LSMEANS, and LSMESTIMATES for a mixed-model analysis.

Koen

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you for the info. I am confused about how to integrate proc plm into my code. Can you help me out

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

```
%LET type=toeph;
proc mixed data= RM cl plots=residualpanel (conditional) plot=boxplot (conditional);
class Block Day Accession Irrigation EU;
model A_log = Accession Day Irrigation
Accession*Day Accession*Irrigation Irrigation*Day Accession*Irrigation*Day
/ ddfm=satterth;
Random Block;
repeated Day / subject=EU type=&type r rcorr;
lsmeans Accession Day Irrigation
Accession*Day Accession*Irrigation Irrigation*Day Accession*Irrigation*Day
/ adjust=Tukey;
store ABCXYZ / label='PLM: Getting Started';
run;
proc plm restore=ABCXYZ;
lsmeans Accession*Irrigation / lines linestable;
ods output LSMLines=LSMLines;
run;
/* end of program */
```

Koen

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.