The script begins by creating a dataset named 'drug' using a DATA statement and in-line data (datalines). This dataset contains information on different substances ('drug'), a continuous variable 'x', the number of successes 'r' and the total number of trials 'n'. Then, it uses PROC GENMOD to fit a logistic regression model. The 'drug' variable is declared as a classification variable (CLASS). The model specifies that 'r' events out of 'n' trials are modeled as a function of 'x' and 'drug', using a binomial distribution (dist=bin) and a logit link function (link=logit). The 'lrci' option requests the calculation of likelihood ratio confidence intervals.
Data Analysis
Type : CREATION_INTERNE
The 'drug' dataset is created directly in the script via the DATA statement and in-line data (datalines).
1 Code Block
DATA STEP Data
Explanation : This code block uses a DATA step to create the 'drug' dataset by reading data directly included in the script via the DATALINES statement. The variables created are 'drug' (character), 'x', 'r', and 'n' (numeric).
Copied!
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
;
1
DATA drug;
2
INPUT drug$ x r n;
3
DATALINES;
4
A .1110 A .23212 A .6719
5
B .2313 B .3415 B .45516 B .78513
6
C .04 0 10 C .15 0 11 C .56112 C .7212
7
D .34510 D .659 D .7810
8
E .21220 E .341520 E .561315 E .81720
9
;
2 Code Block
PROC GENMOD
Explanation : This block executes the GENMOD procedure to fit a generalized linear model. It specifies the 'drug' dataset as input, declares 'drug' as a classification variable, and defines a logistic regression model ('dist=bin', 'link=logit') where the ratio 'r/n' is modeled as a function of 'x' and 'drug'. The 'lrci' option requests likelihood ratio-based confidence intervals.
Copied!
proc genmod data=drug;
class drug;
model r/n = x drug / dist = bin
link = logit
lrci;
run;
1
PROC GENMODDATA=drug;
2
class drug;
3
model r/n = x drug / dist = bin
4
link = logit
5
lrci;
6
RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : S A S S A M P L E L I B R A R Y
Related Documentation
Aucune documentation spécifique pour cette catégorie.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.