Statalist


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

RE: st: forvalues and _N


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: forvalues and _N
Date   Sun, 12 Oct 2008 17:02:08 +0100

The help _is_ complete on this question, just terse. 

The affordability of the manuals remains a separate issue, although no
doubt it bites hard. I can't add to many earlier comments on this issue.
But there is no taboo on talking about this on the list. It's just the
same question will get the same answers! 

One of the forms that 

expansion_optr 

can take is listed as 

= exp

and links take you to other entries for Stata's language, including exp
as indicating an expression. 

Michael also overlooked my point that a relevant tutorial exists with no
marginal cost to him. 

Nick 
[email protected] 

Michael I. Lichter

Thanks Nick and Martin, although I don't see this in either -help macro-

or -help variables- ... unless it's the uninterpretable (to me)

	"[...] `expansion_optr' [...]"

in -help macro- (FYI: Stata 9.2). I'm guessing that it IS in [P] Macro, 
but I frankly can't afford the manuals and wish Stata would make them 
available free online like SAS or on the install DVD like SPSS or at a 
reasonable price in PDF form online which I know is one of those things 
you're not supposed to talk about on Statalist. Grrr.

Michael

Nick Cox wrote:

> I think what Michael wants to know is documented better at -help
macro-.
> 
> 
> `=exp' where exp is an expression lets you evaluate an expression on
the
> fly and use its result. 
> 
> `=2 + 2' would be in these terms: the expression is 2 + 2; Stata would
> evaluate that; and the command would see 4. 
> 
> As the example implies, the expression can be a single item such as
_N. 
> 
> This has been in Stata since (I think) sometime during Stata 7 but was
> not documented until Stata 8. There is a discussion within 
> 
> SJ-3-2  pr0009  . . . . . . . . . . . . . Speaking Stata:  Problems
with
> lists
>         . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
N.
> J. Cox
>         Q2/03   SJ 3(2):185--202                                 (no
> commands)
>         discusses ways of working through lists held in macros
> 
> which is visible under the 3-year rule. 
 
 
> P.S. The help and the manuals are, as always, the first documentation
to
> think of. Typically, the FAQs fill in some odd gaps or fill out some
> tricky topics. 
> 
> Martin Weiss
> 
> see -help _variables-. The equal sign evaluates this -expression- so
no
> need 
> for any -macro-...
> 
> Michael I. Lichter
> 
>> Whoa! This works even though `=_N' is clearly not a macro. Is this an

>> undocumented feature, or is it a "real" part of Stata that will stick

>> around? I'm sorry if this is discussed somewhere in the FAQ -- I have
> no 
>> idea how to search for it.
> 
> Philip Ryan wrote:
>>> Try:
>>>
>>> forvalues i = 1/`=_N'  {
>>>
>>> ....
>>>
>>> }
>>>
> 
> *
> *   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/

-- 
Michael I. Lichter, Ph.D.
Research Assistant Professor & NRSA Fellow
UB Department of Family Medicine / Primary Care Research Institute
UB Clinical Center, 462 Grider Street, Buffalo, NY 14215
Office: CC 125 / Phone: 716-898-4751 / E-Mail: [email protected]
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index