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

st: postfile - posting a string


From   Danielle Ferry <[email protected]>
To   StataList <[email protected]>
Subject   st: postfile - posting a string
Date   Mon, 21 Mar 2005 18:10:16 -0500

Statalisters,
In the example below, I have a local variable containing a list of variable names, and in the <postfile> procedure I want to post each variable name in that list. In particular, I want the variable "var" in the tempfile "predictions" to be a string and to have an entry of "mcd" in obs 1 and an entry of "priv" in obs 2. The way it is currently written, it posts the VALUE of each variable in the list. Can anyone please help with this?
Much thanks,
Danielle Ferry

local insvars "mcd priv ";
tempname memhold;
tempfile predictions;

postfile `memhold' var z1 z2 using `predictions';

foreach var of varlist `insvars' {;
[do stuff]
post `memhold' (`var') (`a') (`b');
};

postclose `memhold';


*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index