| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: byindex variables
Fred said
I have a program that is byable(recall). Suppose my byvariable is sex,
taking on 3 levels: 0 female, 1 male, . missing. I can track in the
program
the iteration, 1, 2 or 3. However, what I want to do is to pick up the
value of -sex- when each of the 3 iterations is being processed so
that I
can pull off the label and pass it to another programs. Is there a
way to
do this?
sysuse auto
capt label def rep 1 "Awful" 2 "Poor" 3 "OK" 4 "Good" 5 "Great"
label values rep78 rep
capt program drop fred
program define fred,rclass sortpreserve byable(recall)
version 9.2
marksample touse
su `_byindex' if `touse', meanonly
local blab: value label `_byvars'
su `_byindex' if `touse', meanonly
local blabval: label `blab' `r(min)'
di "category `blabval'"
end
Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/