Hi there
I have a dataset in format with about 50 rows:
...........
I would like to create new variables corresponding to exact lower and upper 95% CI for the proportion (freq/grouptotal) for each row (i.e. by groupname).
In Stata 12, I was able to create this in a separate file by combining statsby with the immediate command cii
statsby upper=r(ub) lower=r(lb), by(groupname) saving ('filename', replace): cii grouptotal freq
In Stata 15, I have updated the syntax to 'cii proportions' but it doesn't work
statsby upper=r(ub) lower=r(lb), by(groupname) saving (filename, replace): cii proportions grouptotal freq
variable found where a number expected; perhaps you meant to use ci
an error occurred when statsby executed cii
It doesn't work with ci either.
In the help menus it says only ci works with statsby.
Please can anyone advise on a solution or an alternative method to do this?
Many thanks
Lorna
I have a dataset in format with about 50 rows:
groupname | freq | grouptotal |
a | 5 | 100 |
b | 12 | 150 |
c | 6 | 200 |
d | 3 | 90 |
e | 1 | 65 |
I would like to create new variables corresponding to exact lower and upper 95% CI for the proportion (freq/grouptotal) for each row (i.e. by groupname).
In Stata 12, I was able to create this in a separate file by combining statsby with the immediate command cii
statsby upper=r(ub) lower=r(lb), by(groupname) saving ('filename', replace): cii grouptotal freq
In Stata 15, I have updated the syntax to 'cii proportions' but it doesn't work
statsby upper=r(ub) lower=r(lb), by(groupname) saving (filename, replace): cii proportions grouptotal freq
variable found where a number expected; perhaps you meant to use ci
an error occurred when statsby executed cii
It doesn't work with ci either.
In the help menus it says only ci works with statsby.
Please can anyone advise on a solution or an alternative method to do this?
Many thanks
Lorna
Comment