/* file name: owlsfit.sas */ /* purpose: fit the linear model using OLS and WLS for the correlated data generated by program gendat.sas */ /* Define libname. */ libname sd 'a:\'; DATA A; SET SSD.GENDAT; /*ssd.gendat ('a:\gendat.sd2') is the SAS data set generated by ngendat.sas */ RUN; /* Perform OLS using generalized linear model*/ PROC GLM; MODEL Y=X; RUN; /* Perform WLS using random effect model.*/ PROC MIXED; CLASS ID; MODEL Y=X/S; /* MODEL satement specifies the fixed component of the model, By default, intercept is included in the model. S requests SAS to print out of the solutions of the fixed effect*/ RANDOM int/TYPE=un SUB=id G; /* RANDOM statement defines the random effect. In the example, INT is included as a random effect (it is not included by default as in MODEL statment). TYPE option specifies the structure of the variance for random effect. TYPE=un means there is no constrain put on the variance structure. SUB is used to specify the variable by which subjects are identified. G requests SAS to print out G matrix, which is the covariance matrix of the random effect (or variance if there is only one random effect as in the example) */ RUN; QUIT; /*the end of the program*/