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/