Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Tomas Lind" <tomas.lind@ki.se> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: SV: RE: SV: RE: postfile |

Date |
Fri, 27 Aug 2010 11:22:14 +0200 |

I get the following error message (note, the variable time in my example corresponds to the variable fönster in my real syntax so the error message is about the variable fönster) saba_L6 -- Binomial Exact -- Variable | Obs Mean Std. Err. [95% Conf. Interval] -------------+-------------------------------------------------------------- - saba_L6 | 3366 .0356506 .0031959 .0296445 .0424797 invalid syntax post: above message corresponds to expression 2, variable fönster r(198); end of do-file r(198); -----Ursprungligt meddelande----- Från: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] För Nick Cox Skickat: den 27 augusti 2010 11:16 Till: 'statalist@hsphsun2.harvard.edu' Ämne: st: RE: SV: RE: postfile "in r" is short for "in red", which it seems is no longer documented, but should be considered equivalent to "as error". What doesn't "doesn't work" mean in your new question? Nick n.j.cox@durham.ac.uk Tomas Lind Unfortunately I don´t understand the abrevation -in r- in your example but when enclosing mpg in "" I display the word "mpg". In my problem the variable prep is a string variable so I should refer to it with "". Then it works. New problem I would also like to post the value of the time-window i (6, 12, 18). I thought that should be simple but the syntax below (and different modifications of it) doesn´t work. Why? tempname resul postfile `resul' str15 prep time mean lb ub /// using H:\ANAL\prevalens.dta , replace foreach i in 6 12 18 { foreach X of varlist saba_L`i' laba_L`i' { preserve bysort idnr (`X') : keep if _n==_N di " " di " " di "`X'" ci `X' , binomial local prep `X' local time `i' local mean = r(mean) local lb = r(lb) local ub = r(ub) post `resul' ("`prep'") (`time') (`mean') (`lb') (`ub') restore } } postclose `resul' preserve use H:\ANAL\prevalens.dta , replace list , noobs restore Martin Weiss The difference between: ************* sysuse auto, clear di in r mpg di in r "mpg" ************* makes your error clear, I think... Tomas Lind Below I try to post results to a dataset. Everything works fine but the variable prep only contain 0´s. I had hoped to find the variable names saba_L6, saba_L12, saba_L18, laba_L6, laba_L12, laba_L18 in it. Anyone know what´s wrong with my syntax? tempname resul postfile `resul' str15 prep mean lb ub /// using H:\ANAL\prevalens.dta , replace foreach i in 6 12 18 { foreach X of varlist saba_L`i' laba_L`i' { preserve bysort idnr (`X') : keep if _n==_N di " " di " " di "`X'" ci `X' , binomial local prep `X' local mean = r(mean) local lb = r(lb) local ub = r(ub) post `resul' (`prep') (`mean') (`lb') (`ub') restore } } postclose `resul' preserve use H:\ANAL\prevalens.dta , replace list , noobs restore * * 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/ * * 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/

**Follow-Ups**:**st: RE: SV: RE: SV: RE: postfile***From:*Nick Cox <n.j.cox@durham.ac.uk>

**References**:**st: postfile***From:*"Tomas Lind" <tomas.lind@ki.se>

**st: RE: postfile***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**st: SV: RE: postfile***From:*"Tomas Lind" <tomas.lind@ki.se>

**st: RE: SV: RE: postfile***From:*Nick Cox <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: RE: RE: SV: RE: postfile** - Next by Date:
**RE: st: looking for more efficient programming for randomly shuffling list of numbers** - Previous by thread:
**st: RE: RE: SV: RE: postfile** - Next by thread:
**st: RE: SV: RE: SV: RE: postfile** - Index(es):