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

st: RE: Parsing not-quite-standard syntax

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Parsing not-quite-standard syntax
Date   Thu, 25 Nov 2004 15:12:09 -0000

There is nothing non-standard here about the 
options, so I will set that on one side: 

program foo
	syntax [name] [if] [in] 
	marksample touse 
	di "|`namelist'|"
	count if `touse' 

shows that the syntax you need may essentially be 
that of your specification. Absent a varlist, 
-marksample- regards every observation as prima 
facie acceptable, but -if- and -in- conditions
may throw out some, as normal. 

I don't however understand the bit about 
variables not in memory. Stata isn't good 
at extra-sensory perception... 

[email protected] 

David Harrison
> I want to write a command with the syntax
> command [name] [if exp] [in range] [, opt1 opt2 *]
> BUT, the -if exp- and -in range- are to be applied in a -use- 
> statement, so they may involve variables that are not in the 
> dataset in memory. Any suggestions on how I can parse this to 
> get the locals `namelist' `if' `in' `opt1' `opt2' and 
> `options' that would be produced by -syntax-?

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index