Dear listers,
I received an excel dataset with col1 identifiying productnumber, while col2 has the text variable for the productnumber.
Col1 col2
1 Table
2 Chair
etc.,etc
Now what I´d like to do is to automatically generate a label for col1 containing col2.
local j=0
global h=""
levelsof col2,local (u)
foreach var in `u'{
local j=`j'+1
global h $h `j'"`""`var'""'"
di "$h"
}
lab define col1 $h
lab val col1 col1
The di "$4" displays everything as planned, except for the sorting that has been carried out by levelsof. Is there workaround ? As of now the values in the columns dont match.
Regards,
M
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/