[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Question: postfile with variable number variables

From   Eve CORDA <>
Subject   st: Question: postfile with variable number variables
Date   Fri, 03 Apr 2009 15:08:58 +0200

Dear all,

I would like to create a new file using the postfile command but the number of variables in the output file is not constant. More specifically, my program might look like that:

local variable_list "var1 var2 var3"
local no_var: word count `variable_list'
postfile postname `variable_list' using filename, replace
forvalues i=1(1)`no_var'{
   local var`i'=`i'
post postname (`var1') (`var2') (`var3')
postclose postname

My problem is that the variable_list macro does not have a constant number of elements. Do you know how I can write the post postname command to take this into account?

Thank you very much fo any help.

Best wishes

Eve Corda

*   For searches and help try:

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