Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: xline


From   "Sebastian F. B�chte" <[email protected]>
To   [email protected]
Subject   Re: st: xline
Date   Wed, 31 Jan 2007 15:35:15 +0100

Eric,

one way would be to wrap the "date literal convenience function" d()
in a local macro  and to return its result to the xline. This could
look like this:

scatter  y1 x1, xlabel(`=d(2jan2006)'(100)`=d(2jan2007)', format(%d))
xline(`=d(2apr2006)')

I think this is equivalent to the following

local startdate   =d(2jan2006)
local enddate    =d(2jan2007)
local markdate  =d(2apr2006)

scatter  y1 x1, xlabel(`startdate'(100)`enddate', format(%d)) xline(`markdate')


hth
Sebastian

On 1/31/07, Eric G. Wruck <[email protected]> wrote:
I am working on a graph & want to insert vertical lines for various
dates, time being the x-axis.  It seems xline will not accept
expressions or variable names, as I have tried, for example:

xline(d(5jan2007))

or

xline(scan1)

where scan1 was previously defined in the .do file with

gen scan1 = d(5jan2007)

The only way I get the thing to work is to have xline(17171), but I
don't want to have to look up all the dates by hand.  Does someone
know an easier way to handle this?

Thanks,

Eric


--

===================================================

       Eric G. Wruck
       Econalytics
       2535 Sherwood Road
       Columbus, OH  43209

       ph:      614.231.5034
       cell:    614.330.8846
       eFax:    614.573.6639
       eMail:   [email protected]
       website: http://www.econalytics.com

====================================================
*
*   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/



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