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]

st: Scatter plot of single variable at different times

From   Christian Raschke <>
Subject   st: Scatter plot of single variable at different times
Date   Wed, 07 Dec 2011 17:30:41 -0600

Hi Stata-listers!

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, I would appreciate a hint in that direction.


Christian Raschke

*   For searches and help try:

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