Dear all,
I’m new to stata and for my research I need the following:
I have two treatments:
1) Focus (0/1/2) where 0 stands for control and 1 for process and 2 for Outcome.
2) Certainty (0/1/) where 0 stands for certain and 1 for uncertain.
I want to generate variables for all the possible combinations CC=(0/0) CO= (0/1) CP=(0/2) & UC=(1/0) UO=(1/1) UP(1/2).
If I gen CC and replace CC = 1 if Certainty==0 & Focus==0, I get 0 real changes. What other code can I use to fix this?
Moreover, I have the variable BP and BP2.
I want to generate avgBP1 for all variables above: egen avgBP1 = mean(CC) such that I can compare the average of BP1 between all combinations.

Due to the 0 changes in the first code this gives me means of 0.

Should I instead of generating variables, make use of more if functions?
E,g. egen avgBP1 = rmean(BP1) if Certainty==0 & Focus==0
This gives me 97 (n=97) missing values.., but I don’t know how to continue.

Thanks in advance!
Daniël