Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Using wild card syntax for variable lists as a program argument


From   "Dupont, William" <[email protected]>
To   <[email protected]>
Subject   st: Using wild card syntax for variable lists as a program argument
Date   Fri, 19 Jan 2007 11:38:25 -0600

I need to write a program that does the same manipulation on a large
number of variables.  I have written a program that does what I want
that works as follows

program recodevariables
...manipulate each variable in the argument list
end
use data.dta
recodevariables tcat tdog tcow
...

The preceding program manipulates the variables tcat, tdog and tcow in
the way I want.

Is it possible to rewrite the program so that I can execute it as

recodevariables t*

?  Inside recodevariables, Stata interprets t* as a single argument.  Is
there a way that I can expand this argument so that argument `1' is tcat
        argument `2' is tdog and
        argument `3' is tcow?

If so, I know how to write the rest of the program.  If not, is there
some other way of writing this program using the wildcard variable
naming convention that I should know about?

With thanks for any advice that you can give me.

Bill

William D. Dupont 
Phone: 615-322-2001               Fax: 615-343-4924
URL: http://biostat.mc.vanderbilt.edu/WilliamDupont

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index