Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Formatting and variable problem


From   "Nick Winter" <[email protected]>
To   <[email protected]>
Subject   st: RE: Formatting and variable problem
Date   Wed, 3 Jul 2002 08:57:18 -0400

> -----Original Message-----
> From: Fred Wolfe [mailto:[email protected]] 
> Sent: Wednesday, July 03, 2002 8:25 AM
> To: [email protected]
> Subject: st: Formatting and variable problem
> 
> 
> I have a program which does various calculation and then ends 
> with the 
> following line:
> 
>           di as text "{ralign `startcol' : `outname'}" " {c 
> |}" as result 
> "{ralign 9: `N' `mean' `sd' `se' `median' `min' `max' `lci' `uci'}"
> 
> If  any of the macros are empty (`N' `mean' `sd' `se' 
> `median' `min' `max' 
> `lci' `uci'), as would often be expected, then no result for 
> the missing 
> macro is displayed. However, each missing macro uses exactly 
> 1 character 
> space. Therefore the output is not uniform as to spacing, and 
> it is hard to 
> line up titles above the output.

I'm not clear what you are doing here.  The blank spaces are coming from
the spaces you have between each local macro.  So, for example:

	. local this "this"
	. local nothing ""
	. local that "that"
	. di "`this' `nothing' `that'"
                  ^         ^

will display "this  that" (with two spaces in between, because of the
spaces in your display command).

So if only *one* of the string of macros will be non-empty, then just
take those spaces out:

	{ralign 9:`N'`mean'`sd'`se'`median'`min'`max'`lci'`uci'}

If you are trying to display more than one statistic from among that
list, then can you tell  more about what you are trying to get?

Cheers,
Nick Winter
*
*   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