Announcement

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

  • Using Mgen Command and Issues with Variable Label

    I am trying to do a post-estimation margins command, and everything looks well with my output, but I am not sure why Stata is telling me that Males doesn't exist when I'm just trying to label the variable. I am not sure if using the dataex command is appropriate or not here so forgive me for not including in this general post.


    . mgen, at(numcigs_r=(.5(5)60) sex=1) atmean stub(Males) ///
    > predlabel(Logit prediction for males)

    Predictions from: margins, at(numcigs_r=(.5(5)60) sex=1) atmean predict(pr)

    Variable Obs Unique Mean Min Max Label
    --------------------------------------------------------------------------------
    Malespr1 12 12 .2586882 .1080438 .4576168 Logit prediction for ...
    Malesll1 12 12 .0849188 .0598954 .1058421 95% lower limit
    Malesul1 12 12 .4324576 .1561922 .8524183 95% upper limit
    Malesnumci~r 12 12 28 .5 55.5 numcigs_r
    --------------------------------------------------------------------------------

    Specified values of covariates

    1. 2. 3. 1. 2.
    sex race race race hrstv_r religion religion
    ----------------------------------------------------------------------------
    1 .0809524 .097619 .0190476 13.45952 .8285714 .0309524

    1. 2. 3. 1. 1. 2. 3.
    friends friends friends unfrien~y exercise exercise exercise
    -----------------------------------------------------------------------------
    .1761905 .247619 .5380952 .3833333 .3047619 .2571429 .25

    . label var Males "prediction for male"
    variable Males not found
    r(111);


  • #2
    You've created several variables that begin with Males: Malespr1, Malesll1, Malesul1... You need to be specific about which of those variables you want to label. I assume:
    Code:
    label var Malespr1 "prediction for male"
    Stata/MP 14.1 (64-bit x86-64)
    Revision 19 May 2016
    Win 8.1

    Comment


    • #3
      Thank you. That worked.

      Comment

      Working...
      X