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')"
}
}