<>
I get the correct answer with this:
*************
capt prog drop myprog
prog def myprog
vers 10.1
syntax, OPTION(string asis)
di `"`option'"'
local new_option: list clean option
di "`new_option'"
end
myprog, option(1 "example")
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Federico
Belotti
Gesendet: Donnerstag, 7. Januar 2010 14:36
An: StataList
Betreff: st: parsing problem
*Dear all,
I've the following parsing problem in writing one of my ado's:
I need that option's argument be returned just as the user typed them,
with quotes and with leading and trailing blanks. So, I use:
*
prog define example
syntax, OPTION(string asis)
*and when I type:*
example, option(1 "example")
*I get what expected, that is:*
di `"`option' " '
1 "example"
*Then I perform some tasks. At some point of the code I need to strip
off double quotes from the local option. I tried without success with:*
1) local new_option: subinstr local option """ "", all
2) local new_option = regexr(`"`option' " ', """, "")
3) local new_option: list clean option
*Can someone help me?
thx
Federico
*
--
Federico Belotti
Faculty of Economics
Department of Financial and Quantitative Economics
Tor Vergata University
tel: +39 06 7259 5624/25
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/