Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Antonio Rodriguez Andres" <Antonio.Andres@emu.edu.tr> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: Grouping income variables- RECODE COMMAND |
Date | Sat, 1 Feb 2014 20:14:53 +0200 |
Here you can see the basic description of the income variable tab hinctnt Household's | total net | income, all | sources | Freq. Percent Cum. ------------+----------------------------------- J | 1,663 4.38 4.38 R | 1,561 4.11 8.49 C | 2,262 5.96 14.45 M | 3,676 9.68 24.13 F | 3,545 9.34 33.47 S | 3,293 8.67 42.15 K | 3,010 7.93 50.08 P | 2,871 7.56 57.64 D | 4,707 12.40 70.04 H | 2,058 5.42 75.46 U | 644 1.70 77.15 N | 428 1.13 78.28 Refusal | 4,525 11.92 90.20 Don't know | 3,540 9.32 99.53 No answer | 180 0.47 100.00 ------------+----------------------------------- Total | 37,963 100.00 sum hinctnt, d Household's total net income, all sources ------------------------------------------------------------- Percentiles Smallest 1% 1 1 5% 2 1 10% 3 1 Obs 37963 25% 5 1 Sum of Wgt. 37963 50% 7 Mean 22.67271 Largest Std. Dev. 31.57352 75% 10 99 90% 77 99 Variance 996.8872 95% 88 99 Skewness 1.378759 99% 88 99 Kurtosis 2.984444 . -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: Saturday, February 01, 2014 7:52 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: Grouping income variables- RECODE COMMAND Your code shows you using the -recode()- function, which is quite different from the -recode- command. In Stata functions and commands are different! I think that to comment helpfully we need to see more about your -hinctnt-, for example, the results of . su hinctnt, detail Your categories are not disjoint as (e.g.) the definitions [70, 120] and [120, 230] leave ambiguous what happens with 120. Alternatively, your notation here confuses the meaning of [ ] and ( ). Nick njcoxstata@gmail.com On 1 February 2014 17:29, Antonio Rodriguez Andres <Antonio.Andres@emu.edu.tr> wrote: > Dear Stata users, > > I have to group the income variable in different intervals. In the > original dataset, the household income variable is grouped İnto 12 > categories > > J <40 > R [40,70] > C [70, 120] > M [120, 230] > F [230, 350] > S > K > P > D > H > U [1730, 2310) > N > 2310 > > I want to group J and R categories <70 Euros, and create dummy > variables for all income groups. That is the Stata ouput. I used the > recode command But it does not work > > gen hinc_gr=recode(hinctnt, 70, 120, 230, 350, 460, 580, 690, 1150, > 1730, > 2310) > (13282 missing values generated) > > . tab hinc_gr > > hinc_gr | Freq. Percent Cum. > ------------+----------------------------------- > 70 | 29,718 100.00 100.00 > ------------+----------------------------------- > Total | 29,718 100.00 > > Regards > > Antonio > > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/