--- Val�rie Orozco wrote:
> What I want to do is to store lists (in a macro) of some variables in my
> data. I use the command "ds" to have them and I thought that thanks to the
> return list r(varlist) I would be able to play with this in my program
> (make some differences and others manipulations of macrolists)...but ir
> doesn't work...
>
> My example is the following :
>
> ds Vol* /*I want Stata to show me all the variables beginning by
> "Vol" in my data*/
> local liste1 `r(varlist)' /*I put it in a local list*/
> di "`liste1'" /*to test it : it woks*/
> local liste1bis `"`liste1'"'
> di `liste1bis' /*and it is a funny result*/
What is going on here has to do with the way -di- works. If you type
-di varlist- it will diplay the values of the first observations of the
variables in varlist. The local `list1bis' contains a string with
variable names separated by spaces (a list). If you type
-di variable list. So, if you type: -di `listbis'- Stata sees
-di varlist- and it displays the first observations of each variable
in the varlist. To see the names of the variables in `list1bis' type:
-di "`list1bis'".
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/