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

st: RE: RE: RE: RE: RE: Parsing not-quite-standard syntax


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: RE: RE: Parsing not-quite-standard syntax
Date   Mon, 29 Nov 2004 08:59:11 -0000

Nick

Many thanks for your suggestions.

After much experimenting, I would add "bind" to the gettoken statement to avoid any problems parsing functions that contain commas (this seems to be a very useful option I had not come across before).

Otherwise, this is pretty much what I have ended up with (but a little more complicated to split off the name from the beginning, as this turns out to be important for the real program). Bundling if and in together has saved a lot of work though. I also like the idea of using -syntax- to parse the rest once the dodgy bits have been removed - very handy.

David


Nick Cox:

> No, that first route is unnecessary. How about 
> 
> program foo
> 	gettoken data 0 : 0, parse(",") 
> 	syntax [, * ]  
> 	use `data', clear 
> 	count 
> 	...
> end 
> 
> That way, any -if- or -in- are just bundled within `data'. 


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