Statalist The Stata Listserver

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

Re: st: Postfile question

From   "Kelvin Foo" <>
Subject   Re: st: Postfile question
Date   Thu, 1 Mar 2007 05:36:51 +0000


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


On 2/28/07, Poon, Kwun Yee <> 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,

Can someone help me solve this mystery?




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 {
     capture tabul gender `var', chi2
     scalar chitest = r(chi2)
   *Writing to external file
     post `sim' (`var') (chitest)
    scalar drop _all
postclose `sim'

*   For searches and help try:

*   For searches and help try:

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