Bookmark and Share

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

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

st: postfile

From   "Tomas Lind" <>
To   <>
Subject   st: postfile
Date   Thu, 26 Aug 2010 17:20:10 +0200

Hi listers,

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'  {

    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')   
postclose `resul'	

use H:\ANAL\prevalens.dta , replace	
list , noobs

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index