The script begins by creating an internal dataset named 'Icecream' via datalines, containing information on the number of observations ('count'), the ice cream brand ('brand'), and taste preference ('taste' which is an ordinal variable). Then, the GENMOD procedure is invoked to model the ordinal response variable 'taste' as a function of the categorical variable 'brand'. The model is specified with a multinomial distribution and a cumulative logit link function. The 'aggregate=brand' option is used to group observations by brand, and the 'type1' option requests Type 1 tests for model effects. Finally, three 'estimate' statements calculate log-transformed odds ratios (LogOR) between different categories of the 'brand' variable and exponentiate them to obtain the odds ratios.
Data Analysis
Type : CREATION_INTERNE
The 'Icecream' dataset is created directly within the script using a DATA statement and datalines. It contains 'count' (frequency), 'brand' (ice cream brand), and 'taste' (ordinal taste preference: vg, g, m, b, vb) variables.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates the 'Icecream' dataset which will be used for the analysis. It defines three variables: 'count' (numeric for frequency), 'brand' (character for brand), and 'taste' (character for taste level). The data is provided directly in the script via the DATALINES statement, making it an internal data source.
Copied!
data Icecream;
input count brand$ taste$;
datalines;
70 ice1 vg
71 ice1 g
151 ice1 m
30 ice1 b
46 ice1 vb
20 ice2 vg
36 ice2 g
130 ice2 m
74 ice2 b
70 ice2 vb
50 ice3 vg
55 ice3 g
140 ice3 m
52 ice3 b
50 ice3 vb
;
1
DATA Icecream;
2
INPUT count brand$ taste$;
3
DATALINES;
4
70 ice1 vg
5
71 ice1 g
6
151 ice1 m
7
30 ice1 b
8
46 ice1 vb
9
20 ice2 vg
10
36 ice2 g
11
130 ice2 m
12
74 ice2 b
13
70 ice2 vb
14
50 ice3 vg
15
55 ice3 g
16
140 ice3 m
17
52 ice3 b
18
50 ice3 vb
19
;
2 Code Block
PROC GENMOD
Explanation : This PROC GENMOD procedure performs a cumulative logistic regression analysis. The 'rorder=data' option maintains the order of the response variable categories as they appear in the data. The 'freq count;' statement specifies that 'count' contains the frequencies for each observation. 'class brand;' declares 'brand' as a categorical variable. The 'model' statement defines the model: 'taste' is the dependent response variable, modeled by 'brand'. The 'dist=multinomial' and 'link=cumlogit' options indicate an ordinal multinomial model with a cumulative logit link function. 'aggregate=brand' aggregates observations by brand for quasi-likelihood calculation. 'type1' requests Type 1 sums of squares. Finally, the 'estimate' statements calculate log-transformed odds ratios (and their exponentiated values) for comparisons between ice cream brands.
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.