Statalist The Stata Listserver


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

Re: st: re: general varlist in programs


From   Kyle Hood <[email protected]>
To   [email protected]
Subject   Re: st: re: general varlist in programs
Date   Mon, 21 May 2007 16:07:23 -0400 (EDT)

I guess they must have improved things from v8 to v9, or there is something I am doing that is wrong.

The workaround that I am using is to employ a foreach var of varlist ... loop, concatenating the variable names into a local variable. Maybe it would be best for me just use stata 9, though.

Thanks for the info.

Kyle

On Mon, 21 May 2007, Kit Baum wrote:


sacrificial ewe

Kyle said

I am using Stata v.8, and I want to write a program like

program progname
syntax varlist
...
end

Where I can call it in a statement like

progname y x* z*

When I try to do so, it gives me an error "* invalid name".

In the overall program that I am writing, I need to input different
numbers of x and z variables, so it's not feasible for me to type them all
out in the program call.

This must be a simple fix, but I just can't find the solution in the help
files. Does anyone know what to do?



I don't have any problem with this in Stata 9.2:

prog drop _all
prog testwild
syntax varlist
di "`varlist'"
end


. testwild pop*
pop poplt5 pop5_17 pop18p pop65p popurban

. testwild pop* m*
pop poplt5 pop5_17 pop18p pop65p popurban medage marriage



Can't say about Stata v8, as I no longer have a copy, but don't see why this would change.

Kit


Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html

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