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

st: generating colnames of arbitrary dimension

From   Robert Duval <>
Subject   st: generating colnames of arbitrary dimension
Date   Sat, 11 Jun 2005 04:24:43 -0400

Hi everybody,

I'm trying to store the output of several estimations on a series of matrices.
I want to be able to label certain columns of my matrices as 

prefix_1 prefix_2 ... prefix_`k'

where k is a local variable arbitrarily set by each routine.

For example, if I estimate svymean with the by(varlist) option, the
number of categories will change for each variable in varlist, and my
program to store the results of each variable is

program by_wprom0, eclass
	args name
	local k = e(n_by)
	matrix define diagV0 = vecdiag(e(V))
	matrix define `name'= ($z1 , e(b) , diagV0 , e(_N) , e(_N_subp) , e(deff))
	local paranames : colnames(e(b))


	matrix colnames `name'= Period `paranames' `varnames' `N' `N_subpop' `Deff'
	matrix drop diagV0

where I would like 'varnames' (as well as `N', `N_subpop' and `Deff' )
to contain a list of the type

var_1 var_2 ... var_`k'

I bet there is an easy way to do this, but I just cannot find it.

Any suggestions are welcome.
Thanks in advance,

*   For searches and help try:

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