Graphics Reference
In-Depth Information
graph hbar wage hours, over(occ7, sort(2)) over(married,
descending
)
Each
over()
option can have its own
separate sorting options. In this
example, we add the
descending
option to the second
over()
option,
and the levels of
married
are now
shown with those who are married
appearing first.
Uses nlsw.dta & scheme vg s2c
Labor
Cler.
Sales
married
Prof
Other
Operat.
Mgmt
Labor
Cler.
Sales
single
Operat.
Other
Prof
Mgmt
0
10
20
30
40
50
mean of wage
mean of hours
graph hbar (sum) wage, over(collgrad) over(occ7) asyvars stack
Say that we were to graph the sum of
wage
broken down by
collgrad
and
occ7
. We further treat the levels of
collgrad
as
Prof
Mgmt
-variables and form a
stacked bar chart. We might want to
sort these bars based on the sum of
wages for each occupation. See the next
example for how we can do that.
Uses nlsw.dta & scheme vg s2c
y
Sales
Cler.
Operat.
Labor
Other
0
1,000
2,000
3,000
4,000
5,000
sum of wage
not college grad
college grad
graph hbar (sum) wage,
over(collgrad) over(occ7,
sort((sum) wage)
) asyvars stack
Here, we add
sort((sum) wage)
to the
over()
option for
occ7
, and then the
bars are sorted on the sum of wages at
each level of
occ7
, sorting the bars on
their total height.
Uses nlsw.dta & scheme vg s2c
Cler.
Operat.
Labor
Other
Mgmt
Prof
Sales
0
1,000
2,000
3,000
4,000
5,000
sum of wage
not college grad
college grad
The electronic form of this topic is solely for direct use at UCLA and only by faculty, students, and staff of UCLA.