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 on April 23, and its replacement, statalist.org is already up and running.


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

st: Scatter plot of single variable at different times


From   Christian Raschke <crasch2@tigers.lsu.edu>
To   statalist@hsphsun2.harvard.edu
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.

Thanks!

Christian Raschke


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