The script begins by creating a dataset named 'diabetes' via a DATA step. The data is provided directly in the code using 'datalines'. A new variable, 'logCP', is calculated by taking the natural logarithm of the 'CPeptide' variable. Then, the 'PROC GAM' procedure is used to fit a generalized additive model. This model aims to predict 'logCP' based on the non-linear effects of the 'Age' and 'BaseDeficit' variables, which are modeled using spline functions. The objective is to examine diabetes patterns, as indicated in the title.
Data Analysis
Type : CREATION_INTERNE
The data is created directly in the SAS script using a 'datalines' statement within the DATA step.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates the 'diabetes' table. It reads three variables (Age, BaseDeficit, CPeptide) from embedded data ('datalines'), then calculates a fourth variable 'logCP' as the natural logarithm of 'CPeptide'. The '@@' option allows reading multiple observations from the same data line.
INPUT Age BaseDeficit CPeptide @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json;
4
logCP = log(CPeptide);
5
DATALINES;
6
5.2 -8.14.88.8 -16.14.110.5 -0.95.2
7
10.6 -7.85.510.4 -29.05.01.8 -19.23.4
8
12.7 -18.93.415.6 -10.64.95.8 -2.85.6
9
1.9 -25.03.72.2 -3.13.94.8 -7.84.5
10
7.9 -13.94.85.2 -4.54.90.9 -11.63.0
11
11.8 -2.14.67.9 -2.04.811.5 -9.05.5
12
10.6 -11.24.58.5 -0.25.311.1 -6.14.7
13
12.8 -1.06.611.3 -3.65.11.0 -8.23.9
14
14.5 -0.55.711.9 -2.05.18.1 -1.65.2
15
13.8 -11.93.715.5 -0.74.99.8 -1.24.8
16
11.0 -14.34.412.4 -0.85.211.1 -16.85.1
17
5.1 -5.14.64.8 -9.53.94.2 -17.05.1
18
6.9 -3.35.113.2 -0.76.09.9 -3.34.9
19
12.5 -13.64.113.2 -1.94.68.9 -10.04.9
20
10.8 -13.55.1
21
;
2 Code Block
PROC GAM
Explanation : This block uses the GAM (Generalized Additive Model) procedure to model the 'logCP' variable based on 'Age' and 'BaseDeficit'. The 'model' statement specifies that both independent variables are fitted using spline functions, allowing for the capture of non-linear relationships. The 'ods graphics on;' statement enables the creation of graphs to visualize the results.
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 : SAS SAMPLE LIBRARY, NAME: gamgs, TITLE: Getting Started Example for PROC GAM, DESC: Patterns of Diabetes, REF: Sockett et al. 1987, PRODUCT: STAT
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.