Announcement

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

  • set seed not giving the same results when I sample

    use data/raw/HARARALLD2024,clear
    merge m:1 HoueholdId using Data/raw/Age_s_ALLH1
    keep if _merge==1
    drop _merge
    ***keep under 1 years
    tab Agegroup,m
    keep if Agegroup=="<1 year"
    set seed 1
    sample 12,count
    duplicates report HoueholdId
    save data/raw/under1_12missing,replace

    Dear all,
    Why would set seed produce slightly different results for dataset under1_12missing every time I sample?.I am confused.Kindly assist.
    I want to include dataset HARARALLD2024 but it is very big (25000 observations). I don't know whether you will manage to help me without it.
    Regards,
    Fred

    .

  • #2
    It is the m:1 merge that results in different sort orders, not the sample command. Ensure that a consistent sort order is maintained after the merge.

    Comment


    • #3
      Thanks Andrew.It was surely a merge issue.So I sorted my data after merge and got the same results

      Comment

      Working...
      X