Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

RE: st: FW: Adding a scalar to a graph note


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: FW: Adding a scalar to a graph note
Date   Tue, 14 Jun 2011 14:20:13 +0100

You can also combine the two syntaxes 

local foo2 : display %06.2f foo

Nick 
n.j.cox@durham.ac.uk 

Phil Schumm

On Jun 14, 2011, at 6:34 AM, Barry Quinn wrote:
> Is it possible to add a scalar which has been created from the  
> results of a test ( in my case it's a ranksum test) into the note of  
> a graph using some Stata code ?


Yes, you can use Stata's expression evaluator inline.  For example:


     scalar foo = 12
     sc y x, note("The value of foo is: `=foo'")


The other alternative, as Oliver noted, is to place the value into a  
macro instead.  One advantage of this approach is that you can apply a  
display format to the value, if desired.  For example:


     . local foo: display %06.2f 12

     . di "`foo'"
     012.00


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index