0% found this document useful (0 votes)
38 views

C:/Users/SHIVANI/Desktop/QTDM Exam

This document contains code to perform several statistical analyses and modeling techniques using SAS software, including: 1) Linear regression is performed to model the relationship between variables x and y in a sample data set. 2) Additional analyses include checking the normality of residuals, finding summary statistics, and viewing data contents. 3) Hierarchical linear modeling is conducted using mixed models to assess relationships both between and within groups while accounting for group structure. 4) Multinomial logistic regression is used to model categorical outcome variables. 5) Generalized linear modeling with a binomial distribution is applied to model rates using the GENMOD procedure.

Uploaded by

Rohit Sethi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

C:/Users/SHIVANI/Desktop/QTDM Exam

This document contains code to perform several statistical analyses and modeling techniques using SAS software, including: 1) Linear regression is performed to model the relationship between variables x and y in a sample data set. 2) Additional analyses include checking the normality of residuals, finding summary statistics, and viewing data contents. 3) Hierarchical linear modeling is conducted using mixed models to assess relationships both between and within groups while accounting for group structure. 4) Multinomial logistic regression is used to model categorical outcome variables. 5) Generalized linear modeling with a binomial distribution is applied to model rates using the GENMOD procedure.

Uploaded by

Rohit Sethi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

data trial;

input x y;
datalines;
2 3
6 4
9 2
8 5
9 4
0 2
;
run;

/*Linear Regression*/
proc reg data=trial;
model x=y;
output out=trial2 residual=r;
run;

/*Checking for normalcy*/
proc univariate data=trial2 normal;
var r;
run;

/*Finding means*/
proc means data=trial sum mean max min mode median;
run;

/*Summary of data*/
proc contents data=trial;
run;

/*Creating a library*/
libname blah "C:\Users\SHIVANI\Desktop\QTDM Exam";

/*Hierarchical Linear Modeling*/
/*Model 1-without any independent variables (to check mean and school-wise
mean)*/
proc mixed data=blah.hsb12 covtest noclprint method=ml;
class school;
model mathach=/solution;
random intercept/solution sub=school;
run;

/*School level independent variable added. can only randomize intercept not
slope, coz the variable does not vary within each school*/
proc mixed data=blah.hsb12 covtest noclprint method=ml;
class school;
model mathach= meanses/solution;
random intercept/solution sub=school;
run;

/*Adding other variables and randomizing the slope of the student level
independent variables*/
proc mixed data=blah.hsb12 covtest noclprint method=ml;
class school;
model mathach= meanses ses female/solution;
random intercept ses female/solution sub=school;
run;

/*Multinomial Logistic Regression*/
proc logistic data=blah.cereal;
class bfast (ref="1") agecat (ref="1")/param=ref;
model bfast= active agecat gender marital/ link=glogit;
output out=arya p=prob;
run;

/*Generalised Linear Models */

data drug;
input drug$ x r n @@;
datalines;
A .1 1 10 A .23 2 12 A .67 1 9
B .2 3 13 B .3 4 15 B .45 5 16 B .78 5 13
C .04 0 10 C .15 0 11 C .56 1 12 C .7 2 12
D .34 5 10 D .6 5 9 D .7 8 10
E .2 12 20 E .34 15 20 E .56 13 15 E .8 17 20
;
run;


proc genmod data=drug;
class drug;
model r/n = x drug / dist = bin;
run;

You might also like