Dear everyone,
I want to draw a random sample of 500 observations that should be reproducible when running the do-file again and again. Despite the set seed command, I always get slightly different results.
Thanks a lot for helping me on that!
Best,
Rike
I want to draw a random sample of 500 observations that should be reproducible when running the do-file again and again. Despite the set seed command, I always get slightly different results.
Code:
egen company_tag = tag(company_uuid) //pick one observation to represent each company set seed 77 randomtag if company_tag, count(500) gen(t) //select a random sample from the tagged obs. this bysort company_uuid: egen select = total(t) //keep all observations from picked companies sum no_org if select == 1 //500 observations keep if select == 1 drop count_investor count_investor_index by investor_uuid, sort: gen count_investor = 1 if _n == 1 by investor_uuid, sort: gen count_investor_index = _n sum count_investor if ba == 1 //901 BAs sum count_investor if ba == 1 & investor_type == "individual" //810 BAs sum count_investor if vc == 1 //173 VCs sum no_org if tag == 2 //118 startups sum no_org if tag == 3 //382 startups
Best,
Rike
Comment