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

st: RE: calling variables

From   "Nick Cox" <>
To   <>
Subject   st: RE: calling variables
Date   Fri, 11 Feb 2005 16:16:22 -0000

I am not quite clear on what the problem 
here is. If you have variables up to 


that should be followed by variables 


then put your variables in order by 
something like this 

foreach y of numlist 52/99 0/5 { 
	local Y : di %02.0f `y' 
	local varlist "`varlist' var_1_`Y'*" 
order `varlist' 

Alternatively, -reshape- so that observations, 
not variables, define time. 


Hans J. Baumgartner
> I’ve got data that is coded as follows:
> var_1_yymm , var_2_yymm and so on.
> If I would like to call the variables var_1 between January 2000 and 
> February2001 I though I could use
> var_1_0001-var_1_0102
> Unfortunately, this is not calling the expected vars but those vars 
> located in the dataset between var_1_0001 and var_1_0102.
> How can I address the desired vars?
> N.B. I’ll call the vars within a loop that shifts the time period 
> forwards and backwards. Hence, I cannot call the vars individually.

*   For searches and help try:

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