Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Dates displaying as SIF rather than HIF on graphs...


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Dates displaying as SIF rather than HIF on graphs...
Date   Fri, 20 Dec 2013 15:32:21 +0000

It is important to keep distinct the ideas of "storage type" and
"display format" (not "display type"). Usually Stata graphs respect
display formats; perhaps what's happening here is that the
superimposition of graphs is causing Stata to give up on that; it's
not noticed that the x variable is identical across graphs.

Whatever the details, -xlabel()- has a suboption -format()- so start
with the extra option

xla(, format(%td))

You might then need to spell out which dates you want shown and their
precise format.

See also http://www.stata-journal.com/sjpdf.html?articlenum=gr0030

Nick
njcoxstata@gmail.com


On 20 December 2013 15:18, Peter Pressman <pspressman@gmail.com> wrote:
> I'm new to Stata, and suspect there's an easy answer to this, but can't
> find one that's quite what I need online despite a couple hours of reading.
>
> Briefly, I'm trying to graph the results of a mixed effects model that
> compares brain volumes within subjects over time.  This means that for each
> time, each subject number (PIDN) is associated with at least two volumes of
> interest.
>
> The Date variable is taken directly from an Excel sheet.  In Data Browser,
> the dates display as, for example, 1/1/2010.  When I describe the variable,
> it's in integer format, with display type %td.
>
> I run the mixed effects models as follows:
>
> *xtset PIDN Date*
>
> *xtmixed Volume1 Date|| PIDN:*
>
> *xtmixed Volume2 Date|| PIDN:*
>
> Having obtained my results, I try to get something of a graphic
> representation.
>
> *tsset LinkID Date, daily*
>
> *label variable Date "date"*
>
> *graph twoway (lfitc Volume1 Date)(lfitci Volume2 Date)(connected Volume1
> Date, connect(L))(connected Volume 2 Date, connect(L)), name
> (FS5_combinedlong) ///*
> *graph save "FS5_combined_long.gph", replace ///*
>
> I can produce graphs without using tsset, but am including it here because
> it seems necessary to manipulate date formatting based on what I've read.
>
> I am using the variable LinkID in the tsset because this is a variable that
> uniquelyidentifies each observation.  It is the only way I've found to avoid
> the "repeated time values" error.  Perhaps this is where the trouble lies?
>
> In any route, subsequently trying to use the format command on dates has
> not worked.  Every time I graph, I get ugly SIF on my x-axis, with no clear
> way to change it.
>
> All I want is the opportunity to display dates in MDY format on the x-axis.
>  How do I make this happen?   Thank you!
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index