Reputation: 49
Although I set sortseed at the beginning of my Stata sessions, it gets reset every time Stata needs to break the tie in sort command. Is there a way to set sortseed for the whole session?
Upvotes: 0
Views: 473
Reputation: 3271
If you set the sortseed, it is set for the whole session. This doesn't mean, however, that if you set the sortseed at the beginning and you sort the exact same dataset multiple times in one session, that you will get the exact same results each time, as the state of the random number generator changes.
However, the result from your whole session will be exactly the same when you run it again.
You can see set sortseed as setting the initial state, which changes as sorting is being carried out. To get the same results each time you sort the same dataset, you have to make sure the random number generator is in the same state, so you would have to set sortseed before each sorting operation.
Also: Maybe the stable option of sort
helps.
Upvotes: 2