Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Define value label. PLEASE HELP !

    Hello. I have an assignment from Stata. I am beginner in this field and don't know the profound using of Stata so much.

    Assignmnet:

    Create a fully labeled version of mpg(mileage), where the values have been classified according to the following table.

    category: mpg:

    low mileage >28
    medium mileage 22-28
    high mileage 18-21
    bad mileage <=17


    If i am not mistaken, the command should be written in that form.

    label define mpg > 28 "low mileage" 22 - 28 "medium mileage" 18 - 21 "high mileage" <= 17 "bad mileage"

    I have tried to write it in this form, but didn't get successful results.

    Just will be glad to get any help and suggestions regarding this issue. Thanks.
    Last edited by Farhad Mammadov; 10 May 2017, 07:39.

  • #2
    Farhad:
    welcome to the list.
    You probably mean that you have an assignment to perform with Stata.
    You shoud have also noticed, as per FAQ, the policy on this forum about posting assigments.
    However, you have challenged yourself in finding out a solution rather than asking somebody else to do your job on your behalf.
    Unforunately your code is illegal.
    My advice would be to attach an integer to each category, creating a new variable -mileage_cat- and then -label- those integers (in a slightly different from the one you use):
    See Example 1 under -label entry in Stata .pdf manual.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Following Carlo's helpful advice I flag that suggestions on (not) asking or answering homework questions are at #4 in http://www.statalist.org/forums/help#adviceextras

      Comment

      Working...
      X