Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Compund quotes and the -file write- command


From   "Eva Poen" <[email protected]>
To   [email protected]
Subject   Re: st: Compund quotes and the -file write- command
Date   Mon, 20 Aug 2007 19:22:48 +0100

Thank you David. It took me a bit longer to get to this point ...

To finish off, here is the shortest solution I managed to come up with:

forvalues x = 1/`n' {
    file write `handle' "capture label variable `=VarName[`x']' \`"
    file write `handle' `"" `=VarLabel[`x']' ""'
    file write `handle' "'" _n
}

Eva

2007/8/20, David Elliott <[email protected]>:
> I had provided this on Aug 9th, but when I scanned the Archive I
> realized it had ended up in Statalist Limbo:
>
> I'm wondering if escaping the interior ` (as a \`) would work:
>
> -file write `handle' `"capture label variable `=VarName[`x']'
> \`"`=VarLabel[`x']'"' "' _n-
>
> I find the display command can often be used to preview the results of
> file write so you can test:
>
> -di `"capture label variable \`"zTree (or other) Session ID
> (alpha-numeric)"' "'-
>
> which produces:
>
> capture label variable `"zTree (or other) Session ID (alpha-numeric)"'
> , the desired output.
>
> D. C. Elliott
> *
> *   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