Bookmark and Share

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]

Re: st: postfile


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: postfile
Date   Thu, 26 Aug 2010 11:37:59 -0400

Tomas Lind <tomas.lind@ki.se> :
You are referring to the first observation of your variable, not its name.
Try using quotes:

loc f "string"
postfile r str6 q using /tmp, replace
post r ("`f'")
postclose r
use /tmp, clear
list

On Thu, Aug 26, 2010 at 11:20 AM, Tomas Lind <tomas.lind@ki.se> wrote:
> Hi listers,
>
> Below I try to post results to a dataset. Everything works fine but the
> variable prep only contain 0愀. 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愀 wrong with my syntax?
>
> /Tomas
>
>
>
> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index