Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# RE: st: Confidence intervals: saving -proportion- estimates to a .dta or .csv file last estimates not found

 From Richard Williams To statalist@hsphsun2.harvard.edu Subject RE: st: Confidence intervals: saving -proportion- estimates to a .dta or .csv file last estimates not found Date Fri, 04 Nov 2011 16:17:57 -0500

```At 08:45 AM 11/4/2011, Tim Evans wrote:
```
I've realised I would like the confidence intervals also. But I'm not sure I can find the right values in -ereturn list- that will allow me to calculate the CIs. Can anyone help?
```
```
First, you want the square roots of the diagonals of the variance matrix, i.e. the standard errors. After -mim-, this matrix is stored in e(MIM_T). Or, just use the -storebv- option, and you get stuff stored in e(b) and e(V). The (untested) code will be something like this:
```
matrix bmat = e(MIM_Q)
matrix vmat = e(MIM_T)
forval j = 1/4 {
gen prop`j' = bmat[1,`j']
gen se`j' = bmat[`j', `j'] ** .5
gen lower`j' = se`j' * -1.96 + prop`j'
gen upper`j' = se`j' * 1.96 + prop`j'
}
sum prop* se* lower* upper*
collapse (mean) prop* se* lower* upper*

```
I am assuming the sample is large and that 1.96 is the appropriate critical value. If small you may need to use the appropriate T value instead. Make sure that the data set matches what the proportion command gave you - it is possible I am doing something wrong here, i.e. given that this is a proportion I might have the formula wrong, in which case you need to hunt down the right formula for the CI.
```
```
```-----Original Message-----
```
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Tim Evans
```Sent: 04 November 2011 11:39
To: 'statalist@hsphsun2.harvard.edu'
```
Subject: RE: st: SOLVED! saving -proportion- estimates to a .dta or .csv file last estimates not found
```
```
```
http://statalist.1588530.n2.nabble.com/mim-and-parmest-td5013352.html

```
from Martin Weiss which shows that mim does not store estimates in e(b) rather e(MIM_Q).
```
Updated code is this:

proportion stage
matrix bmat = e(MIM_Q)
forval j = 1/4 {
gen prop`j' = bmat[1,`j']
}
sum prop*
collapse (mean) prop*

Best wishes

Tim

-----Original Message-----
```
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Tim Evans
```Sent: 04 November 2011 11:31
To: 'statalist@hsphsun2.harvard.edu'
```
Subject: RE: st: saving -proportion- estimates to a .dta or .csv file last estimates not found
```
```
Having tried both methods suggest by Maarten and Richard, I think Richard's will work best, but I have a problem in that I am using this on a multiple imputed dataset. When I run the analysis, I am returned with an error (details below):
```
mim: proportion stage if _mj>0 & inrange(yydx,1985,1989)
matrix bmat = e(b)

r(301)

yet when I run this:

proportion stage if _mj>0 & inrange(yydx,1985,1989)
matrix bmat = e(b)
forval j = 1/4 {
gen prop`j' = bmat[1,`j']
}
sum prop*
collapse (mean) prop*

Its absolutely fine - but not what I want.

Any suggestions appreciated.

-----Original Message-----
```
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Richard Williams
```Sent: 03 November 2011 18:27
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: saving -proportion- estimates to a .dta or .csv file

At 11:54 AM 11/3/2011, Tim Evans wrote:
>I'm trying to save and export the proportion estimates I obtain from
>using -proportion- into a useable data file, either .csv or .dta.
>
>However having googled this and looked at help resources with
>-proportion- I don't seem to find what I am after.
>
>How would I return the results from the following code into a data file:
>
>sysuse auto
>proportion rep78 , over(foreign)

The estimates are ereturned in e(b). If nothing else you could
generate variables equal to those values, cut your data set down to
one case, and save under a new name. Something like

sysuse auto
proportion rep78 , over(foreign)
matrix bmat = e(b)
forval j = 1/10 {
gen prop`j' = bmat[1,`j']
}
sum prop*
```
```
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.7370352,"math_prob":0.5162311,"size":4652,"snap":"2020-10-2020-16","text_gpt3_token_len":1405,"char_repetition_ratio":0.13274527,"word_repetition_ratio":0.18025751,"special_character_ratio":0.29901117,"punctuation_ratio":0.17227319,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9574158,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-02-19T00:56:53Z\",\"WARC-Record-ID\":\"<urn:uuid:0bc3ef4b-2891-426f-aced-3e16be290d01>\",\"Content-Length\":\"14036\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:fa5ac898-b8dd-4d41-94a5-ad8ed96679ca>\",\"WARC-Concurrent-To\":\"<urn:uuid:ec17c72f-a148-437b-a0b4-11b9c8297367>\",\"WARC-IP-Address\":\"66.76.6.5\",\"WARC-Target-URI\":\"https://www.stata.com/statalist/archive/2011-11/msg00276.html\",\"WARC-Payload-Digest\":\"sha1:23W5RNP3HJTMOE2W7IBG63B5ZK7BGARZ\",\"WARC-Block-Digest\":\"sha1:EK64WHB2L5UH6VVJAZBCXLO2R4NZMQXT\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-10/CC-MAIN-2020-10_segments_1581875143963.79_warc_CC-MAIN-20200219000604-20200219030604-00082.warc.gz\"}"}