Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: postfile


From   "David Harrison" <David@icnarc.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: postfile
Date   Mon, 22 Nov 2004 13:05:05 -0000

You need to declare the variable 'variable' as being string in your postfile statement, eg

postfile `out' str20 variable case sd1 ...

(NB you may need to increase the 20 above to be as large as your longest variable name)

David
david@icnarc.org

-----Original Message-----
From: VISINTAINER PAUL [mailto:PAUL_VISINTAINER@nymc.edu]
Sent: 22 November 2004 12:59
To: statalist@hsphsun2.harvard.edu
Subject: st: postfile


In the following program, I write the output of several t-tests to a file.  Is it possible to post the name of the variable being tested to such a file?  When I include ("`var'"), I get the error below.  If I post (`var'), I only get a number. 
 
tempname out
. postfile `out' variable case sd1 n1 control sd2 n2 using outfile, replace
. foreach var of varlist igf bp3 {
. 2.   qui ttest `var', by(case)
  3.    post `out' ("`var'") (r(mu_2)) (r(sd_2)) (r(N_2)) (r(mu_1)) (r(sd_1)) (r(N_1)) 
  4. }
type mismatch
post:  above message corresponds to expression 1, variable variable
r(109);

Any suggestions would be appreciated.
 
Thanks, 
Paul Visintainer

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