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

st: string variables and postfile - elementary question


From   Natalie Karavarsamis <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: string variables and postfile - elementary question
Date   Fri, 6 Dec 2002 10:25:18 +1100

Hello,

I am using -postfile- within a program to save -rclass- results. Initially,
I have a data set with 30 variables executing commands and then -post-ing
and saving the results in "`results.dta'". So I end up with `results'.dta
file with 30 rows (1 record per original variable) and the results stored as
variables (columns). 
My problem: 1) I want to create a variable (1 column) in the new file
containing the 30 variable names (30 rows) from the initial file and 2) post
this into the results.dta file. However, postfile will not let me -post-
non-numeric values i.e strings (i've got the variable names in a local macro
`list'), how do I get around this?


(I hope I am understandable)

What I wish I could do was:

prog define icc	
  postfile `icchold' nutrient rho lb ub rel N rho_enadj lb_enadj ub_enadj
rel_enadj N_enadj using "`results'",replace

  ......code....

 post `icchold' (return(nut_tmp)) (return(rho_tmp)) (return(lb_tmp))
(return(ub_tmp)) (return(rel_tmp)) (return(N_tmp)) (return(rhores_tmp))
(return(lbres_tmp)) (return(ubres_tmp)) (return(relres_tmp))
(return(Nres_tmp))

postclose `icchold'
end

where nutrient & (return(nut_tmp)) are of string type and all else are
numeric




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index