Statalist


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

st: AW: How to list variables with certain characters in the variable names?


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: How to list variables with certain characters in the variable names?
Date   Sat, 22 Aug 2009 19:21:18 +0200

<>


" I want to list variables..."


Your request has been answered to your full satisfaction, but note that
"list" could mean several things. -ds- is most helpful if you want the set
of variables satisfying your condition assembled in a return value.  

If all you wanted was to run some command on these variables, any command
that takes a -varlist- will happily expand the "*x*" thing for you, and no
detour via -ds- is necessary.


***
clear
set obs 10
gen x =runiform()
gen yx=4
gen r=2
gen zerx=rnormal()
reg ze *x*
***

Also note that -lookfor x- would also yield the same result...


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von gjhxmu@sina.com
Gesendet: Samstag, 22. August 2009 17:40
An: statalist
Betreff: st: How to list variables with certain characters in the variable
names? 

Dear statalists,
How to list variables with certain characters in the variable names? 
I think -ds- could produce something I need. However, I did not find 
a solution in -ds-.

For example, I have variables x, jj,aa,bb,yxz,xxj, ix in the dta.
I want to list variables x, yxz,xxj,ix, which has a character "x"
in the variable names.


Thank you for any help.

Best regards,
Rose.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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