Hi everybody,
I have a question about programming a DCE, and I really hope somebody can help me since I'm not used to work in SAS (different coding..).
I want to create a DCE with two options (vaginal delivery vs caesarean delivery) and different scenario alternatives consisting of 5 attributes, and 2-3 levels (see below)
Attributes | Level 1 | level 2 | level 3 |
Age mother | 22 year | 32 year | 42 year |
BMI mother | 23 | 32 |
|
Parity | Primiparity | Multiparity – in obstetric history normal vaginal birth | Multiparity – in obstetric history previous caesarean for dystocia |
Underlying pathology | No – uncomplicated pregnancy | Yes – mild preeclampsia |
|
Estimated birth weight | 2400g | 3300g | 4000g |
So 108 possibilities and I think it should be a factorial design.
I tried looking in the community and searching in PROC BCHOICE but it won't work. See below for my attempt. What am I doing wrong and what is next in order to create the question like the added file?
Thank you so much!
%mktruns (2 ** 2 3 ** 3);
%mktex (2 ** 2 3 ** 3, n=72, seed= ?);
Proc format;
value Age 1 = 22 2 = 32 3 = 42;
value BMI 1 = 23 2 = 32 ;
value Parity 1 = primiparity 2= multiparity in obstetric history normal vaginal birth 3 = multiparity in obstetric history previous caesarean for abnormal CTG;
value Underlying_pathology 1 = no uncomplicated pregnancy 2 = yes mild preeclampsia;
value Estimated_birth_weight 1 = 2400 2 = 3300 3 = 4000;
run;
%mktlab(data=design, /* input data set */
Vars= Age BMI Parity Underlying_pathology Estimated_birth_weight, /* new attribute names */
int=f1-f2, /* create 2 columns of 1’s in f1-f2 */
out=final, /* output design add a format statement for the attributes */
stms=format Age Age. BMI BMI. Parity Parity. Underlying_pathology Underlying_pathology. Estimated_birth_weight Estimated_birth_weight.)
proc print; run;
https://support.sas.com/techsup/technote/mr2010c.pdf
There is an extensive discussion in the link. Search for "candidate set of alternatives" examples. There are many other possibilities as well.
Thanks for your response.
According to example 6 I tried programming my DCE. However it doesn't work when I'm running it.
What am I doing wrong?
Thanks again!
Title DCE 1-5 #2
%mktruns(3 2 3 2 3)
%mktex(3 2 3 2 3, /* factor level list for one alternative */
n=72) /* number of candidate alternatives */
proc format;
value age 1 = 22y 2 = 32 y 3 = 42 y;
value BMI 1 = 25 2 = 32;
value Parity 1= Primiparity 2 = ’Multiparity – in obstetric history normal vaginal birth’ 3 = ’Multiparity – in obstetric history previous caesarean for abnormal CTG’;
value 'Underlying pathology' 1 = ’No – uncomplicated pregnancy’ 2 = ’Yes – mild preeclampsia’;
value 'Estimated birth weight' 1 = 2400g 2 = 3300g 3 = 4000g;
run;
%mktlab(data=design, /* input data set */
vars=Age BMI Parity 'Underlying pathology' 'Estimated birth weight', /* new attribute names */
int=f1-f4, /* create 4 columns of 1’s in f1-f4 */
out=final, /* output design */
/* add a format statement for the attributes */
stmts=format age age. bmi bmi. parity parity. 'Underlying pathology' path. 'Estimated birth weight' weight.)
proc print; run
I have not run your code, but you need to get the quotes right in you value statements for starts.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.