Thanks Nick, right now you are my statahero. The option number 2 give me
exactly what I want.
Let me explain two more things:
1. CIE-10 is the international clasification of sicknesses. I think that I
can assign the code with the corresponding description in Excel, is not a
big deal.
2. Months ago I asked to the list how can I generate some age groups. I use
that help in order to have a frequency of the hospital discharges by age
groups. The problem here is that I found that my variable age was a string8
variable. Then the options to generate a new variable was restricted: I
tried typing:
gen str8 rank_edad=1 if inrange(edad,0,0) to construct my age groups (less
than 1 year, between 1 and 4, between 5 and 9, 10-19, 20-29, 30-39, 40-49,
50-59 and the last one 60 or more)
This not work for me so I try:
encode edad, gen (edad2) like I learned from my net course on Stata. The
things appear to be ok, because when I type tab edad2 I see all the ages
correctly. The problem here is that I'm building three groups (the first
three) that don�t have data on it. But Stata is calculating something on
it, I don't know why.
gen byte rank_edad=1 if range(edad2,0,0)
replace rank_edad=2 if inrange (edad2,1,4)
replace rank_edad=3 if inrange (edad2,5,9)
replace rank_edad=4 if inrange (edad2,10,19)
and so on.....
tab rank_edad
rank_edad | Freq. Percent Cum.
------------+-----------------------------------
1-4_anos | 90 1.73 1.73
5-9_anos | 1190 22.88 24.61
10-19_anos | 2114 40.64 65.24
20-29_anos | 892 17.15 82.39
30-39_anos | 304 5.84 88.24
40-49_anos | 202 3.88 92.12
50-59_anos | 162 3.11 95.23
Mas_60_anos | 248 4.77 100.00
------------+-----------------------------------
Total | 5202 100.00
Do you know or guess why Stata is putting data on the first three groups
that is supposed to be empty (I build those groups because I'm making a do
file, that I can apply to other databases).
Thanks....
Rodrigo
begin 666 winmail.dat
M>)\^(A 1`0:0" `$```````!``$``0>0!@`(````Y 0```````#H``$(@ <`
M& ```$E032Y-:6-R;W-O9G0@36%I;"Y.;W1E`#$(`0V ! `"`````@`"``$&
M@ ,`#@```-('!P`,``L`% ````4`$ $!`Y &`'P*```I````"P`"``$````+
M`",```````,`)@``````"P`I```````#`"X```````,`-@``````'@!P``$`
M```7````475E<W1I;VX@86)O=70@=&%B<V]R= ```@%Q``$````E`````<(I
MN7V>D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Z
M!3 ?D"@B\%_#)3&E8>])%EHV7X(`P&LMDB^@8I#_86%><!Y *KI9,")Q,H$O
M<-L@`6-C8BB !Y I,$L=E*MU7@@`9!YA;R-D?:\`````'@!"$ $````T````
M/$5$15!+2TY,3TA-2%!!0TY"3TI%145'04-&04$N;BYJ+F-O>$!D=7)H86TN
M86,N=6L^``,`"5D!````"P`1@ @@!@``````P ```````$8``````X4`````
M```#`!* "" &``````# ````````1@`````0A0````````,`$X (( 8`````
M`, ```````!&`````%*%``".:@$`'@`4@ @@!@``````P ```````$8`````
M5(4```$````$````.2XP`!X`%8 (( 8``````, ```````!&`````#:%```!
M`````0`````````>`!: "" &``````# ````````1@`````WA0```0````$`
M````````'@`7@ @@!@``````P ```````$8`````.(4```$````!````````
M``L`&( (( 8``````, ```````!&``````Z%`````````P`9@ @@!@``````
MP ```````$8`````$84````````#`!J "" &``````# ````````1@`````8
MA0````````L`&X (( 8``````, ```````!&``````:%`````````P`<@ @@
M!@``````P ```````$8``````84````````+`!Z "" &``````# ````````
M1@````""A0```0````(!^ \!````$ ```(DOD*ZI'LU/K(F*650/:K0"`?H/
M`0```! ```")+Y"NJ1[-3ZR)BEE4#VJT`@'[#P$```!P`````````#BANQ %
MY1 :H;L(`"LJ5L(``&US<'-T+F1L; ``````3DE40?F_N $`J@`WV6X```!$
M.EQ->2!$;V-U;65N='-2;V1R:6=O7%)E<W!A;&1O<UQ/=71L;V]K7')E<W M
M,#(M,#$M,#(N<'-T``,`_@\%`````P`--/TW```"`7\``0```#$````P,# P
M,# P,#@Y,D8Y,$%%03DQ14-$-$9!0S@Y.$$U.34T,$8V04(T,#1#,S)!,# `
M`````P`&$%YXF\,#``<0Z 4```,`$! ``````P`1$ `````>``@0`0```&4`
M``!42$%.2U-.24-++%))1TA43D]764]505)%35E35$%404A%4D]42$5/4%1)
M3TY.54U"15(R1TE614U%15A!0U1,65=(051)5T%.5$Q%5$U%15A03$%)3E17
23TU/4D542$E.1U,Z`````![9
`
end
*
* 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/