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: Scatter plot of single variable at different times
From
Nick Cox <[email protected]>
To
[email protected]
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
<[email protected]> 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/