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/