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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Scatter plot of single variable at different times


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Scatter plot of single variable at different times
Date   Thu, 8 Dec 2011 09:23:57 +0000

. scatter ln_wage L.ln_wage if year == 69

This depends on a previous -tsset-, easy enough.

By the way, I would reverse axes in your example. Later is more
obvious a response than earlier, so belongs on the y axis.

Nick

On Wed, Dec 7, 2011 at 11:30 PM, Christian Raschke
<crasch2@tigers.lsu.edu> wrote:

> I have a panel data set in long format. I would like to make a scatter plot
> of a single variable observed at different time periods.
>
> Below is a silly example. The example code below plots individuals' log
> wages in 1968 against log wages in 1969. But I would like to know if there
> is a "cleaner" way to do this. Is there a way that I could select two
> different time periods and arrive at such a scatter plot without having to
> manually -reshape- my data each time?
>
> webuse nlswork, clear
> keep idcode year ln_wage
> reshape wide ln_wage, i(idcode) j(year)
> scatter ln_wage68 ln_wage69
>
> If there is anything built into Stata, or if there is any user-written ssc
> command that does exactly this,
*
*   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