I have written a very simple program to conduct a lottery among nine people. The results of a given run look like this.
Variable draw comes from a call to runiform()
I'd like to see how this little routine behaves over a number of trials, say a thousand. I thought that a simple way to do it would be to run a foreach loop, saving the results in a .dta file from the first trial and then appending subsequent results to the existing file. Then I could just look at the distribution of ranks by name. But the Stata save command does not allow one to append to an existing file. In fact, no Stata output command, e.g. export excel appears to allow one to append so far as I can tell. I looked at the post command, but I don't think it will do what I want to do either. So, how can I run multiple trials of this, each time saving the results for all nine of the cases? Clearly, I'm missing something obvious here, but I don't know what it is.
Code:
"Dave" .9838091 9 "Chuck" .9698822 8 "Jim" .9612048 7 "Karen" .8696807 6 "Katy" .8337011 5 "Shane" .6246807 4 "Dick" .50225854 3 "Bill" .21390353 2 "Sue" .16608635 1 end
Variable draw comes from a call to runiform()
I'd like to see how this little routine behaves over a number of trials, say a thousand. I thought that a simple way to do it would be to run a foreach loop, saving the results in a .dta file from the first trial and then appending subsequent results to the existing file. Then I could just look at the distribution of ranks by name. But the Stata save command does not allow one to append to an existing file. In fact, no Stata output command, e.g. export excel appears to allow one to append so far as I can tell. I looked at the post command, but I don't think it will do what I want to do either. So, how can I run multiple trials of this, each time saving the results for all nine of the cases? Clearly, I'm missing something obvious here, but I don't know what it is.
Comment