Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Postfile question


From   "Poon, Kwun Yee" <poonk@anesthesia.ucsf.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Postfile question
Date   Wed, 28 Feb 2007 15:25:33 -0800

Dear list, 

I have a question on postfile syntax.  Using the following syntax, I was
expecting vari_name to store var1, var2, etc.  However, when I open the
result.dta, the values stored in vari_name is the values stores in var1,
etc.

Can someone help me solve this mystery?

Thanks,

Trudy

*****syntax********

set more off
tempname sim
postfile `sim' str15 vari_name chistat using result, replace
use "inputdata.dta", replace

quietly {
    foreach var of varlist var1-var10 {
    *Crosstab
      capture tabul gender `var', chi2
      scalar chitest = r(chi2)
    *Writing to external file
      post `sim' (`var') (chitest)
     scalar drop _all
    }
   }
postclose `sim'
clear
 


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index