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: RE: question on line graphs

From   "Nick Cox" <>
To   <>
Subject   st: RE: question on line graphs
Date   Mon, 19 Apr 2010 17:00:19 +0100

Michael Norman Mitchell suggested one approach. Here is another that
avoids all -collapse-, -preserve-, -restore-. 

egen pc12 = mean(100 * (taxation < 3)), by(cohort year)
separate pc12, by(cohort) veryshortlabel 
line pc12? year 

The resulting graph file may be a little bloated. It could be slimmed
down by 

egen tag = tag(cohort year) 
line pc12? year if tag 

See also the existing FAQ by Scott Merryman and friend:
How can I create variables containing percent summaries? 


Thaker, Anant

I am a Stata 11/SE user. In my dataset, I have a cohort variable coded
1-4 with the various subgroups (e.g. 1 = <1934, 2 = 1934-1948, etc.),
and an ordered variable that shows views on progressive taxation (coded
1-5 in terms of relative support). These data points are spread over a
number of years (from the General Social Survey). I'm trying to chart
out the % of respondents who selected 1 or 2 on the taxation variable,
by cohort subgroup, over time. So the x-axis would be year, the y-axis
would be "% who chose 1 or 2," and there would be four line graph series
(one for each cohort subgroup). Would really appreciate some help! I can
clarify as needed. Thanks!

Note: data is currently coded as this example:
2008  1965       1
1996  1975       3

*   For searches and help try:

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