Announcement

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

  • What does gen variable=group(variable1) create?

    I intended to create a different value for each unique value of variable 1 and wrote

    gen variable=group(variable1)
    o know the correct way of doing it is with "egen" instead of "gen"

    variable1 takes numeric values.
    There are around 300 unique values of variable1

    egen generates it correctly - values from 1 to 300.
    but gen also generates it without promting any error - values from 1 to around 4800. there doesnt seem to be any recognizable pattern that i can tell how those values were created.

    i am trying to figure out whether there is any system behind those values (incidentally results with those 4800 f.e. are much better than with 300).

    Thanks for your help!

  • #2
    This group() went undocumented in Stata 9. See https://www.stata.com/statalist/arch.../msg00260.html for more of the story.

    In general egen functions and functions that work outside egen are completely disjoint, even if they share the same name.

    Comment

    Working...
    X