Bookmark and Share

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

[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 <>
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.


On Wed, Dec 7, 2011 at 11:30 PM, Christian Raschke
<> 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:

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