# SAS for regression with categorical and quantitative explanatory variables

I am analyzing growth over time for 5 different cultivated forms (cultivars) of maize. Graphing the data reveals a clear linear pattern for all the cultivars in the time interval I am interested in. Multiple linear regression with categorical (5 cultivars) and continuous (7 time points) explanatory variables appears to be one way to approach this problem, but I am having trouble with the coding in SAS 9.3. I'd like to compare slopes and intercepts between all the genotypes. I should add that new (independent) organ samples were taken at each time point (e.i. I did not measure the same plant organ at each time point). So far, I've read the proc reg manual, and some very useful information at http://www.ats.ucla.edu/stat/sas/webbooks/reg/Chapter7/sasreg7.htm.

Nonetheless, I haven't found a straightforward example on how to approach this problem.

Any suggestions?

-
I'll let someone else tell you the best way to get SAS to do stuff, but you should note that you need to use a mixed-effects model to deal with your longitudinal data. –  gung Aug 2 '12 at 15:30
Thanks, gung. Is this because I need to model the variance-covariance matrix to account for correlated errors? I guess I did not make it clear, but I want to use the regression equations (I have modeled other variables that do not behave linearly using proc nlin successfully) for prediction and to compare the parameters of these equations that have biological interpretation. I am not simply interested in knowing if cultivar A is different than B at time Z and so forth... –  Pedro Aug 2 '12 at 16:19
Yes, you need to account for the fact that your data are not independent. Doing so will let you validly test for differences among your cultivars overall (not just at some time point). You will also be able to make accurate predictions in the future given your model. –  gung Aug 2 '12 at 16:25
So, for the non-linear case do you think that using a non-linear regression approach (PROC NLIN) with weighted residuals (I used the inverse of the sqrt of the variable) is not appropriate? I did not clarify this before, but I took different samples at each time point, so i was not measuring the same plant/organ over time. I had assumed that this would make them independent (though I've had others object to that assumption), and that the weighted analysis took care of heteroscedasticity. –  Pedro Aug 2 '12 at 16:43
That's interesting; you should definitely edit your question to make that clear. I think that should be sufficient to take your data as independent. –  gung Aug 2 '12 at 16:55

proc glm data = mydata;

PROC REG does not handle categorical variables directly (you would need to code them in a data step). PROC GLM also offers lots of plots and things, see the documentation.