Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SV: st: SV: AW: Output from tabulate to a matrix


From   [email protected] (William Gould, StataCorp LP)
To   [email protected]
Subject   Re: SV: st: SV: AW: Output from tabulate to a matrix
Date   Thu, 21 Jan 2010 13:13:21 -0600

Tomas Lind <[email protected]> writes, 

> One last question. -local mynames- contains lots of areas so it
> would be nice to have some line-breaks (so it is not just one long
> row in my do-editor).
>
>        local mynames "Stockholm Uppsala Södermanland �stergötaland
>        Jönköping Kronoberg Kalmar Gotland Blekinge Skåne Halland
>        VästraGötaland Värmland �rebro Västmanland Dalarna Gävleborg
>        Västernorrland Jämtland Västerboten Norrbotten"
>

Martin has already suggested changing the delimiter.  There are two 
other solutions.

One solution, and my favorite, is to omit the quotes altogether:

         local mynames Stockholm      Uppsala     Södermanland   ///
                       �stergötaland  Jönköping   Kronoberg      ///
                       Kalmar         Gotland     Blekinge       ///
                       Skåne          Halland     VästraGötaland ///
                       Värmland       �rebro      Västmanland    ///
                       Dalarna        Gävleborg   Västernorrland ///
                       Jämtland       Västerboten Norrbotten

Note that I used the /// line-continuation marker on all but the last 
line.  When you omit the quotes, multiple blanks are converted to a 
single blank, and that is exactly what we want.

The other solution I rarely use.  It concerns the case where the elements 
themselves contain quotes, so I cannot omit the outside quotes as I 
just did.  In that case, I sometimes code:

	local myfiles `""first file name""'
	local myfiles `"`myfiles' "second file name""'
	local myfiles `"`myfiles' "third file name""'

Usually, however, in this case I follow Martin's suggestion and temporarilyi
switch the delimiter to semicolon.

Forgive the use of the compound quotes, but I have to use them on the outside
because the elements themselves contain quotes.  The elements themselves 
needed the quotes because they contained blanks.  I used simple double 
quotes for the inside elements, but I could have used compound quotes 
throughout:

	local myfiles `"`"first file name"'"'
	local myfiles `"`myfiles' `"second file name"'"'
	local myfiles `"`myfiles' `"third file name"'"'

-- Bill
[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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index