I created a postfile and now trying to display the results from that postfile. There are two variables in the postfile, "var" which is a string and contains the name of variable from univariate logistic regression and "pval" which is a float and contains the p-value for that regression. I am trying to display the output in a specific way and therefore created a new variable which should enable a loop to run however I am only getting output from the first line and no subsequent entries. Would appreciate help with my logic/syntax...
gen n = _n
forvalues i = 1/10 {
if n == `i' {
local vname = var
local p = pval
disp "`vname' " _col(10) "(p=" %4.3f "`p')"
}
}
Related Posts with For-loops are killing me!
Tabulating distinct counts of an ID by groupI have the data in dataex below, I just want a table that is number of unique cID by group so like t…
Generating MAR and MNAR datasetsHi, I would like to generate from a full dataset with a single variable y: 2x5 datasets that contain…
Major problem importing Excel fileDear all, I have a major problem importing data from an excel sheet into Stata - specifically I get …
Using bysort egenHi everyone, I am using the command Code: bysort $id: egen . The result I got containing the missi…
different plotopts with combomarginsplotI am carrying the following regressions: reg sav_finimp`wave' ib3.group##i.year savimp`wave' margin…
Subscribe to:
Post Comments (Atom)
0 Response to For-loops are killing me!
Post a Comment