Bartlett's data is created directly in the script via a DATALINES block. The variables are 'Length' (long/short), 'Time' (spring/immediately), 'Status' (dead/alive) and 'wt' (weight/frequency).
1 Code Block
DATA STEP Data
Explanation : This DATA Step block creates the 'bartlett' dataset from internal data provided via the DATALINES statement. It defines the variables Length, Time, Status, and wt, representing respectively the cutting length, planting time, survival status, and the weight or frequency of each factor combination. The invalid part of the INPUT line (` @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json`) has been removed to make the code executable.
Explanation : This block uses PROC CATMOD to fit a log-linear model to Bartlett's data. The `weight wt` option indicates that the 'wt' variable contains the observation frequencies. The `model` statement specifies the model variables and `_response_` indicates that the model applies to the implicit response variable. The `noparm` and `pred=freq` options are used for output. The `loglin` statement fits a log-linear model without a third-order interaction (specified by ` @ 2`), exploring interactions up to order 2 between Length, Time, and Status.
Copied!
title 'Bartlett''s Data';
proc catmod data=bartlett;
weight wt;
model Length*Time*Status=_response_
/ noparm pred=freq;
loglin Length|Time|Status @ 2;
title2 'Model with No 3-Variable Interaction';
quit;
1
title 'Bartlett''s Data';
2
PROC CATMODDATA=bartlett;
3
weight wt;
4
model LENGTH*Time*STATUS=_response_
5
/ noparm pred=freq;
6
loglin LENGTH|Time|STATUS @ 2;
7
title2 'Model with No 3-Variable Interaction';
8
QUIT;
9
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.