Statalist The Stata Listserver


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

Re: st: Postfile question


From   "Kelvin Foo" <kelvinski@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Postfile question
Date   Thu, 1 Mar 2007 05:36:51 +0000

Hi,

Will your problem be solved if you had
post `sim' ("`var'") (chitest)
instead of
post `sim' (`var') (chitest)  ?

Kelvin.

On 2/28/07, Poon, Kwun Yee <poonk@anesthesia.ucsf.edu> wrote:
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/

*
*   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