Announcement

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

  • Generate unique random integer

    Dear experts,

    I have a numeric identifier which is missing in observations that have no positive laboratory results..I encoded the variable and its largest value is 3999, the total sample size is just over 10000

    I need to use that variable to reshape my data from long to wide, thus I need to assign random values to its missing part,

    the problem is when I use the following line, I get many duplicates:

    Code:
    replace identifier= floor((14000-4000+1)*runiform() + 4000) if identifier==.
    I am struggling to create a unique random integer using the following command

    Any help is greatly appreciated

    Omar

  • #2
    Duplicate post. If interested please follow http://www.statalist.org/forums/foru...random-integer

    Comment


    • #3
      Sorry Nick, did not know how to delete it

      Comment

      Working...
      X