Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Label values with a range


From   "Sergiy Radyakin" <serjradyakin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Label values with a range
Date   Wed, 6 Feb 2008 10:41:16 -0500

Perhaps recode will do the job:


. sysuse auto, clear
(1978 Automobile Data)

. recode price (0/5000=1 "Cheap") (5001/10000=2 "Not cheap") (10000/.
=3 "Expensive")
> , generate(priceclass)
(74 differences between price and priceclass)

. tab priceclass

  RECODE of |
      price |
    (Price) |      Freq.     Percent        Cum.
------------+-----------------------------------
      Cheap |         37       50.00       50.00
  Not cheap |         27       36.49       86.49
  Expensive |         10       13.51      100.00
------------+-----------------------------------
      Total |         74      100.00


Best regards,
  Sergiy Radyakin



On 2/6/08, Benjamin Allaire <btallaire@hotmail.com> wrote:
> Hi all -
> I would like to label the values in my dataset with a range (instead of having to make an entirely new variable)
>
> For example, all values between 1 and 10 (not just integers) would be labeled group I, 10.1-20 would be group II, etc.
>
> Is there a way to do this?
>
> Thanks in advance for any help!
>
> Ben
>
> _________________________________________________________________
> Climb to the top of the charts! Play the word scramble challenge with star power.
> http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan
> *
> *   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/
>
*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index