Statalist The Stata Listserver


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

Re: st: RE: Stata functions


From   Fred Wolfe <[email protected]>
To   [email protected]
Subject   Re: st: RE: Stata functions
Date   Mon, 23 Jan 2006 20:17:13 -0600

At 06:17 PM 1/23/2006, you wrote:
I suspect that this was decided as the
convention a long time ago and Stata
has stuck to it since.

There is at least one very good reason, however.

You are thinking of functions for which the
arguments in practice are always lists of variables, but
syntactically there is nothing to stop you typing
other stuff, say,

<snip>
Actually, I don't want any of the other stuff, I just to work with a varlist.

While it is simple to put in commas with a program, its awkward to work with local macros and return lists with interactive Stata commands (You could use globals, I guess). So the easiest thing would be to allow varlists in selected functions (wish list for Stata 10).

In addition, occasionally in programming one might want to fill in a function. Its MUCH easier to do this with a varlist than by filling in commas.


Nick
[email protected]

Fred Wolfe

> Apropos of the recent discussion of inlist, I have often
> wondered why Stata
> doesn't allow varlists in functions, but instead requires
> comma separated
> lists. For example,
>
> missing(,a,b,c,d,...) is required. Why not a varlist? I can't
> quite see any
> difference. However, in terms of programming, a varlist is
> much easier.
>
> reg y  a b c if !min(b_*)
>
> is much easier than typing each of the 10 b_ variables which
> may be long
> and easy to misspell.

*
*   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/

Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel (316) 263-2125     Fax (316) 263-0761
[email protected]


*
*   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