This script creates a 'six' dataset containing information about respiratory symptoms (wheeze) in two cities (Kingston and Portage). It then uses the GENMOD procedure to fit a logistic regression model (binomial distribution) to predict the presence of wheezing based on city, age, and smoking status. The REPEATED statement is used to specify an exchangeable correlation structure (type=exch) to manage repeated measures on the same subject ('case' variable).
Data Analysis
Type : INTERNAL_CREATION
Data is manually generated within the script via the DATA 'six' step and the DATALINES statement. No external source is required.
1 Code Block
DATA STEP Data
Explanation : Creates the 'six' dataset by reading raw data included in the code. A DO loop is used to read multiple observations (4 repeated measures per subject) from a single line of source data. Note: The original code contains artifacts ' @code_sas_json...' which appear to be copy-paste errors replacing the standard ' @code_sas/16.4'.sas line retention sign.
Copied!
data six;
input case city$ @;
do i=1 to 4;
input age smoke wheeze @;
output;
end;
datalines;
1 portage 9 0 1 10 0 1 11 0 1 12 0 0
...
;
1
DATA six;
2
INPUT case city$ @;
3
DO i=1 to 4;
4
INPUT age smoke wheeze @;
5
OUTPUT;
6
END;
7
DATALINES;
8
1 portage 9 0 110 0 111 0 112 0 0
9
...
10
;
2 Code Block
PROC GENMOD
Explanation : Executes a generalized linear models analysis. The model specifies a binomial distribution for the dependent variable 'wheeze'. The REPEATED statement manages the correlation between observations of the same subject ('case') by using an exchangeable covariance structure, typical of GEE analyses.
Copied!
proc genmod data=six;
class case city;
model wheeze(event='1') = city age smoke / dist=bin;
repeated subject=case / type=exch covb corrw;
run;
1
PROC GENMODDATA=six;
2
class case city;
3
model wheeze(event='1') = city age smoke / dist=bin;
4
repeated subject=case / type=exch covb corrw;
5
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.
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.