Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: RE: [programming] using -if- in do file


From   "Nick Winter" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: [programming] using -if- in do file
Date   Thu, 12 Dec 2002 12:47:54 -0500

Yes, -anything- makes syntax much more flexible.  

It showed up as part of the 6 December 2001 update to Stata 7.  So watch
out--your program will crash if anyone with an older executable trys to
run it.

-Nick Winter

-----------------------------------------------------------
 Nicholas Winter, Ph.D.                     P 202.939.5343
 Policy Studies Associates                  F 202.939.5732
 1718 Connecticut Avenue, NW     [email protected]
 Washington, DC 20009-1148           www.policystudies.com
----------------------------------------------------------- 

> -----Original Message-----
> From: FEIVESON, ALAN H. (AL) (JSC-SD) (NASA) 
> [mailto:[email protected]] 
> Sent: Thursday, December 12, 2002 12:39 PM
> To: '[email protected]'
> Subject: st: RE: RE: [programming] using -if- in do file
> 
> 
> Nick - 
> 
> I think  -syntax anything- may actually achieve what I want 
> inside an .ado
> file as you suggest. I was not aware of the "anything" argument. It
> apparently is not in the manual (at least I can't find it)  - 
> but it does
> appear in the -help-. I see a whole new vista of 
> possibilities now that I
> know about this trick. Thanks for the suggestion.
> 
> Al Feiveson
> 
> -----Original Message-----
> From: Nick Winter [mailto:[email protected]]
> Sent: Thursday, December 12, 2002 9:54 AM
> To: [email protected]
> Subject: st: RE: [programming] using -if- in do file
> 
> 
> > -----Original Message-----
> > From: FEIVESON, ALAN H. (AL) (JSC-SD) (NASA) 
> > [mailto:[email protected]] 
> > Sent: Thursday, December 12, 2002 10:51 AM
> > To: 'statalist'
> > Subject: st: [programming] using -if- in do file
> > 
> > 
> > Hello - Is there a way to restrict observations over which a do-file
> > operates without using the -syntax- command? The syntax 
> > command allows [if]
> > and [in] options, but is extremely picky about using numbers 
> > or non existent
> > variable names in the argument list. Therefore I'd rather 
> > check for the -if-
> > condition directly. I assume there must be some system macro 
> > which stores
> > the -if- or -in- condition. How can I get it without using 
> -syntax- ?
> 
> I assume you mean to say "ado-file", not "do-file".  
> 
> My approach, if you want the if/in and/or options parsing 
> capability of
> syntax, would be to use the "anything" argument of -syntax-, which
> allows an arbitrary set of stuff where the varlist would normally go.
> 
> 	syntax anything [if] [in] , OPtion(string)
> 
> See -help syntax-
> 
> -Nick Winter
> *
> *   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/
> 
*
*   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