Help using Base SAS procedures

Proc MIXED- including continuous variables in analysis

Reply
Occasional Contributor
Posts: 14

Proc MIXED- including continuous variables in analysis

I am using a split-plot, RCBD to study soil gas efflux, and analyze it with PROC MIXED. Fert is the main-plot (N=4), Nfix is the sub-plot (n=4). It is a repeated measure by Date. PlotID idntifies each of the 16 plots by its Fert*Nfix treatment. Fert, Nfix, Block, Date, PlotID are all categorical variables, either Y or N or an integer. SAS returns a detailed analysis with no erros in the log.

However, when i try to analyze this data by inserting a conitnuous variable, VWC (soil moisture), i run into problems. If if i do not include VWC in the Class statement, and only in the Model statement, i get: "ERROR: Only CLASS variables allowed in this effect." However, if i include VWC in the Class statement, it treats each VWC measurement as a treatment, and nearly crashes the computer due to the LSMeans comparison trying to compare each of ~500 measurements.

How do include a continuous variable in my analysis without getting a Class variable error or including it in the Class statement?

 

(code)

proc mixed;
Class Block Fert Nfix Date PlotID;
Model logCH4= Fert Nfix Fert*Nfix Date Date*Fert Date*Nfix;
Random Block Fert*Block;
Repeated Date / subject=plotID Type=CS;
lsmeans Fert Nfix Nfix*Fert Date Date*Fert Date*Nfix/pdiff adjust=tukey;
run;

Occasional Contributor
Posts: 10

Re: Proc MIXED- including continuous variables in analysis

[ Edited ]

Did you make sure that your VWC variable is actually numeric? Check the formatting on that one. It sounds like it's asking you why you've put a Character variable in the model statement, without declaring it in the Class statement first. See if that wasn't the case, because what you are trying to do should work just fine. 

 

Also, I'm a real fan of HPMIXEDtry using that ( I think it's apart of SAS/STAT)...that thing is beast-mode when it comes to processing data. Your model times will (should) drastically decrease. Especially when you have many/crossed random + repeated effects. But I don't think you can get the Adjustment  option in LSMEANS with HPMIXED

 

Bonus round: You could use HPMIXED to obtain starting points for the CovarianceParameter estimation...then pass those along to Proc Glimmix, just in case you find that your data are non-normally distributed. Likewise, you can pass them into Proc Mixed as well, in order to get the Tukey adjustment in the LSMEANS statement. 

 

Just for reference, it would look something like this?? I'm not exactly sure...the important part is using a fast procedure like HPMIXED to generate CovParms to pass into some other Proc...it's pretty powerful!!

 

 

ods output close;
Proc Hpmixed;
	Class Block Fert Nfix Date PlotID;
	Model logCH4= Fert Nfix Date
			Fert*Nfix Date*Fert Date*Nfix;
	Random Block Fert*Block;
	Repeated Date / subject=plotID Type=CS;
	ods output CovParms=Parms;
run;
quit;

proc Glimmix;
	Class Block Fert Nfix Date PlotID;
	Model logCH4= Fert Nfix Date 
			Fert*Nfix Date*Fert Date*Nfix 
			/dist=Normal link=identity;
	Random Block Fert*Block;
	Random Date / subject=plotID Type=ar(1) residual;
	parms parmsdata=Parms;
	lsmeans Fert Nfix Nfix*Fert Date Date*Fert Date*Nfix/pdiff adjust=tukey;
run;
quit;

 

Occasional Contributor
Posts: 14

Re: Proc MIXED- including continuous variables in analysis

Thanks for the enthusiastic response!

One question: the VWC column does have some empty cells, when the soil moisture meter failed on certain measurements. Does this affect the ability of MIXED to analyze the data? Ie., will i need to tell SAS to ignore empty cells?

Occasional Contributor
Posts: 10

Re: Proc MIXED- including continuous variables in analysis

No problem!

 

So, Mixed (as well as all other Stat Procs, im pretty sure) is just going to ignore those records that have blank fields that are either in your: Response or model variables. 

 

It will give you a warning note like: "Some observations are not used in the analysis because of missing fixed effects (n=10)"

 

shouldn't be a big deal though, unless you're missing a ton of records. 

Ask a Question
Discussion stats
  • 3 replies
  • 175 views
  • 0 likes
  • 2 in conversation