How come when we do
We get three parts of the legend each named "cigsale"? Ideally I'd want them to be named "California", "East South Central" and "Mountain" division. I know we can just rename them with the ordering option, but why doesn't Stata do this automatically? Do I sound stupid for asking this?
EDIT:
This is the first time I've ever needed
I guess this works, but I still don't get why Stata wouldn't do this intrinsically. Presumably there's a better way?
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input byte region int year float cigsale
1 1970 109.7
1 1971 117.65
1 1972 126.025
1 1973 132.375
1 1974 138.125
1 1975 142.225
1 1976 147.425
1 1977 148.3
1 1978 149.975
1 1979 146.85
1 1980 148.975
1 1981 145.925
1 1982 146.725
1 1983 142.175
1 1984 134.425
1 1985 135.225
1 1986 129.3
1 1987 131.45
1 1988 129.9
3 1970 123
3 1971 121
3 1972 123.5
3 1973 124.4
3 1974 126.7
3 1975 127.1
3 1976 128
3 1977 126.4
3 1978 126.1
3 1979 121.9
3 1980 120.2
3 1981 118.6
3 1982 115.4
3 1983 110.8
3 1984 104.8
3 1985 102.8
3 1986 99.7
3 1987 97.5
3 1988 90.1
4 1970 116.51428
4 1971 118.87143
4 1972 127.4
4 1973 127.7
4 1974 129.52856
4 1975 131.82857
4 1976 132.48572
4 1977 130.92857
4 1978 129.88571
4 1979 128.75714
4 1980 125.92857
4 1981 126.37143
4 1982 122.61429
4 1983 116.57143
4 1984 107.72857
4 1985 106.22857
4 1986 103.48572
4 1987 99.6
4 1988 93.58572
end
label values region region
label def region 1 "East South Central", modify
label def region 3 "California", modify
label def region 4 "Mountain", modify
cls
twoway (line cigsale year if region==3, lcolor("12 10 0")) ///
(line cigsale year if region==1, lcolor(gs13)) ///
(line cig year if region==4, lcolor(gs14))
EDIT:
This is the first time I've ever needed
Code:
xtset region year, y xtline cigsale if inlist(region,1,3,4), overlay

Comment