BookmarkSubscribeRSS Feed
snca229
Calcite | Level 5

Hello SAS Community!

 

I am having a bit of trouble figuring out the best code to use for my experiment. The more I work to fix my syntax, the more confused that I get.

 

Background: This is set up as a split plot design with repeated measures. The main plot is two different animal diets (n=5 per treatment). The subplot consists of each animal being treated with 7 different hormones and having one control. Response variable were measured at 4 different time periods (24, 48, 72, and 96 hours). The data is non-normally distributed and a log transformation must be done. Homogeneity is good. Below is my code with example data (not complete or accurate responses). 

I also need to correctly get a means separation test into the code. 

 

Note: red and green refer to the two different diets. 

 

data CLP4;

      input diet $ hormone $ P24 P48 P72 P96;

      logP24=log(P24);

      logP48=log(P48);

      logP72=log(P72);

      logP96=log(P96);

      datalines;

Green Control     861.32      162.11      119.865     28.276

Green Control     1135.02     238.79      155.245     29.156

Red   Control     735.28      236.76      162.445     55.276

Red   Control     605.66      159.37      85.745      23.012

Red   hCGhigh     1327.96     313.22      110.92      23.348

Red   hCGhigh     1270.6      338.74      179.25      65.848

Green hCGhigh     511.02      179.81      132.59      65.81

Green hCGhigh     583.68      186.54      147.97      65.214

Red   hCGlow      1593.04     178.93      129.305     24.524

Red   hCGlow      1217.32     188.14      116.29      34.58

Green hCGlow      1124.98     215.46      172.355     53.776

Green hCGlow      1134.72     307.38      182.755     53.194

Green Lhhigh      1066.66     174.89      98.87 21.806

Green Lhhigh      971.68      157.94      96.47 29.132

Red   Lhhigh      1269.44     203.6 129.8 28.152

Red   Lhhigh      1116.28     205.19      117.04      36.484

Green Lhlow 1579.42     157.65      87.445      16.3618

Green Lhlow 832.18      141.38      .     21.344

Red   Lhlow 1164.04     236.01      117.305     43.928

Red   Lhlow 1229.82     245.31      120.22      21.252

Green Lhlow 880.78      166.95      166.25      53.41

Green Lhlow 824.12      192.95      208.71      75.614

Green PGEhigh     892   168.11      127.925     44.886

Green PGEhigh     909.5 240.74      133.37      28.458

Red   PGEhigh     1025.72     311.68      206.7 56.778

Red   PGEhigh     1163.88     313.18      174.51      44.816

Green PGElow      1170.58     232.94      160.64      39.612

Green PGElow      1167.52     277.79      150.705     38.01

Red   PGElow      658.18      198.81      118.925     30.568

Red   PGElow      776.2 221.04      145.615     46.994

Red   PGEmed      1095.34     277.01      229.63      70.582

Red   PGEmed      896.92      309.11      175.595     64.732

Green PGEmed      1051.36     288.48      212.295     63.306

Green PGEmed      1368.44     267.82      244.565     93.674

;

proc mixed data CLP4;

      class diet hormone;

      model logP24- -logP96= diet hormone diet*hormone/ ddfm=KR;

      repeated time 4 (24 48 72 96) polynomial/summary printe;

      lsmeans diet hormone diet*hormone/pdiff lines;

      run;

 

1 REPLY 1
RyanKCarr
SAS Employee

Hi,

 

I'm not quite sure from your question what your goal is.  If you are looking for a multivariate response, would something like the following help?

 

I've also included time as a numeric variable in case you were looking to leverage the linear (or non-linear) structure of change over time, but I haven't worked that into the model yet.

 

Ryan

 

data clp4y ;
   set clp4 ;
   logy = logp24 ;
   var = 'logp24' ;
   time = 24 ;
   output ;
   logy = logp48 ;
   var = 'logp48' ;
   time = 48 ;
   output ;
   logy = logp72 ;
   var = 'logp72' ;
   time = 72 ;
   output ;
   logy = logp96 ;
   var = 'logp96' ;
   time = 96 ;
   output ;
run ;

proc mixed data=CLP4y ;
      class var diet hormone;
      model logy = var diet hormone diet*hormone/ ddfm=KR;
      repeated var / r ;
      lsmeans diet hormone diet*hormone / pdiff=all ;
      *repeated time 4 (24 48 72 96) polynomial/summary printe;
      *lsmeans diet hormone diet*hormone/pdiff lines;
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1079 views
  • 0 likes
  • 2 in conversation