Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 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