Hi everyone,
I am trying to show certain parameter estimates in a caterpillar graph.
I am conducting a Bayesian analysis with proc bchoice and get many different estimates per individual (I have 1,000 survey participants).
So e.g. I have a variable that is named AA,N 0001 which is the estimate for AA for individual 0001.
I am trying to put all estimates in a caterpillar graph but it wouldn't work.
I have tired %cater(datat=mydata, var=AA,N_: ) ; but I get: All positional parameters must percede keyword parameters.
If I try %cater(datat=mydata, var=AA: ) ; but I get: Syntax error.
Thanks for your help!
Best,
Alex
Hi Cynthia,
thank your for your quick answer. I just ran proc contents and it shows me the variable names (e.g. AA,N 0001, AA,N 0002, etc.), the type (numerical) and the length (8).
Do you think I have to rename the variables?
Thank you!
Alex
Hi Cynthia,
the variables are produced by the BCHOICE procedure. I am using the "random" option in order to create a random effects model.
The variables are produced in the output data set.
Best,
Alex
I think you are seeing labels, not variable names. Run the following to see the real names:
proc contents data=MY_OUTPUT_DATA short;
run;
You ought to be able to cut and paste from that output into the macro.
I ran the Getting Started example, which uses a RANDOM statement. I used the OUTPOST= option on the PROC BCHOICE statement to create an output data set. In that example, the variable names are created as normal SAS variables, but the labels are as you described.
Hi,
I did run proc contents and it shows me the Variables (AA,N 0001), its type, the length and the label (AA,N 0001). So the label and the variable name seem to be identical in this case. How can this be?
Please provide
1. the PROC BCHOICE code that you are using
2. The output from
proc contents data=MY_OUTPUT_DATA SHORT;
run;
where you replace MY_OUTPUT_DATA by the name of the data set created by PROC BCHOICE.
proc bchoice data=CSDesignEffect outpost=EffectPost
nmc=5000 thin=2 seed=123
nthreads=4 ;
class N Set;
model choice= No
AA AF BA DL _50_ _100_
P1100 P1300 P1800 P2000
/ choiceset=(Set);
random AA _50_ P1100
/ subject=N
monitor=(1 to 5) type=un;
run;
You dd not use the SHORT option:
proc contents data=EffectPost SHORT;
run;
Please also submit
proc options option=validvarname value;
run;
and copy/paste the output that appears in the SAS log. It will look something like this:
Option Value Information For SAS Option VALIDVARNAME
Value: V7
Scope: Default
How option value set: Shipped Default
Hi,
the validvarname=v7 code worked, thank you very much Rick and Cynthia!
Best,
Alex
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.