|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: AW: help with encode
<>
Miranda might also want to use the -trim()- function if the strings she is
processing are contaminated with unwanted blanks...
*************
clear*
input str5 gender
m
f
f
m
f
m
m
f
m
" m "
end
compress
gen male=trim(gender)=="m"
ta male, m
l
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Miranda Kim
Gesendet: Donnerstag, 23. Juli 2009 15:21
An: [email protected]
Betreff: st: help with encode
How can I efficiently convert string variables (such as gender with
values 'f' 'm') into binary 0/1 variables?
Can I fiddle with encode so that it codes 0/1 instead of 1/2?
Many thanks
*
* 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/
*
* 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/