On Dec 9, 2007, at 6:20 PM, Milly Marston wrote:
I would like to get the value label categories of my variables into
matrices so for a simple example
For sex labelled 1=male and 2=female:
1 2
male female
Where the first row is the values and the second the labels (or
transposed)
Note that you would have to format 1 and 2 as strings here, since
matrices (in Mata) must either have all numeric or all string values
(i.e., not mixed types).
Also with st_vlmap you seem to have to explicitly write down all
the values labels you would like in the matrix whereas I would need
it to be able to vary so I can put all my variables through the
command without listing each number corresponding to the value label
You would probably want to use st_vlload() instead:
. lab def foo 1 "apple" 2 "orange" 3 "pear"
. mata: st_vlload("foo", values=., text=.)
. mata: (strofreal(values),text)'
1 2 3
+----------------------------+
1 | 1 2 3 |
2 | apple orange pear |
+----------------------------+
-- Phil
*
* 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/