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

st: RE: calling variables


From   "David Harrison" <David@icnarc.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: calling variables
Date   Fri, 11 Feb 2005 16:14:16 -0000

If the order of the variables in your dataset is not important, then you could reorder them so that var_1_0001-var_1_0102 does refer to the correct variables, with the command:

aorder var_1_????

Or indeed, if you want to do the same thing with var_2_yymm etc:

aorder var_?_????

Other methods are possible but complex (would not be a simple varlist).

David
david@icnarc.org

-----Original Message-----
From: Hans J. Baumgartner [mailto:hbaumgartner@diw.de]
Sent: 11 February 2005 15:58
To: statalist@hsphsun2.harvard.edu
Subject: st: calling variables


Dear statalist,

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.

All comments are welcomed.

Many thanks in advance.

Hans



-- 
Hans J. Baumgartner DIW Berlin
German Institute for Economic Research
Dept. Public Economics
Königin-Luise-Str. 5; 14195 Berlin; Germany
Tel.: +49/30/89789-307
Fax.: +49/30/89789-114
http://www.diw.de
http://www.hansbaumgartner.de


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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