Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Isolate the 'if statement' from a regression command
From
"Lythgoe, Dan" <[email protected]>
To
"'[email protected]'" <'[email protected]'>
Subject
st: Isolate the 'if statement' from a regression command
Date
Mon, 28 May 2012 13:06:47 +0000
Dear statalist,
Is there a simple way to isolate the 'if statement' from a regression command line for storage as a local macro? Ideally we could do with being able to parse using "if" in -tokenize-, but parse() only accepts single characters and instead parses on "i" and "f":
Sysuse auto
reg price mpg headroom if foreign==1
local cmdline `e(cmdline)'
tokenize "`cmdline'", parse("if")
di "`1'" " | " "`2'" " | " "`3'"
Kind regards
Dan
*
* 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/