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

Re: st: graph syntax and smalldlg queries


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: graph syntax and smalldlg queries
Date   Sun, 11 May 2003 18:55:07 +0100

b. water <[email protected]> asked two questions 
about graphs. I will comment on the first 

> couple of queries for which i would appreciate advice and help.
w98se, stata 
> v8, 04/16 update.
> 
> 1. how do i produce a neat syntax like this one for e.g.:
> 
> . histogram volume, freq normal
>                 xaxis(1 2)
>                 ylabel(0(10)60, grid)
>                 xlabel(12321 "mean"
>                       9735 "-1 s.d."
>                      14907 "+1 s.d."
>                       7149 "-2 s.d."
>                      17493 "+2 s.d."
>                      20078 "+3 s.d."
>                      22664 "+4 s.d."
>                                         , axis(2) grid gmax)
>                 xtitle("", axis(2))
>                 subtitle("S&P 500, January 2001 - December 2001")
>                 note("Source:  Yahoo!Finance and Commodity Systems,
Inc.")
> 
> i have cut and pasted this from stata help. ordinarily, i would type
all 
> these continously so i end up with three continous lines on the
command 
> windows before pressing return to excute the command. i think
there's 
> something to be said about doing it neatly in that it makes what's
to be 
> graphed and spotting error easier. i have looked at the [G] and [U]
but 
> could find advice about this syntax (i used the word syntax for want
of a 
> better description). if this lay-out was just to make it nicer for
the 
> manual or on-line help then i would appreciate if someone could
confirm the 
> fact. if otoh, there's actually a way to make it nice and
structured, would 
> appreciate it too if someone could advice me how or where to look
for  the 
> instructions.

The layout within the manuals was chosen entirely for clarity, 
I imagine. Except within literal strings, Stata is indifferent 
to the precise spacing between elements of a command. That is, you 
can use one, two or more spaces according to choice. 
Indeed in some cases at least you can even omit
spaces between elements, although I wouldn't recommend it. 

In part, this issue was addressed recently by Bill Dupont and several 
people commented. In essence, there is not a way to do this 
within the command window short of inserting lots of spaces yourself
in the obvious but slow way, 
but it is easier to do it within Stata's do file editor or within 
your own favourite text editor in preparing do files. 

It is clearly most helpful when learning the syntax. At the other 
extreme, there are plenty of arguments favouring setting and
following definite conventions for Stata programs intended to be
durable, as have often been rehearsed. 
 
Nick
[email protected]
*
*   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