Date: Fri, 9 Oct 2009 07:36:11 -0700
Reply-To: haiyan chen <haiyan_c@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: haiyan chen <haiyan_c@YAHOO.COM>
Subject: Re: How to repeat a program 10,000 times and How to append the
Content-Type: text/plain; charset=us-ascii
The original program has at least 5 steps to come to the final dataset as the following:
(1) generate 10 random values from a norm(0,1) and order them
(2) calculate sum and std of the 10 values for later use, named Sn and s from now on
(3) delete the smallest value and then calculate sum of k values of the left 9 values where k=1,2,3,4,5,6,7,8,9, named Sk from now on.
(4) calculate Gk by the formula Gk=(Sk-Sn)/s, where k=1,2,3,4,5,6,7,8,9
(5) select max(Gk) and output it as a dataset with one variable mgk and one observation.
Now I want to repeat the above step to get 10,000 mgk.
--- On Fri, 10/9/09, Joe Matise <email@example.com> wrote:
From: Joe Matise <firstname.lastname@example.org>
Subject: Re: How to repeat a program 10,000 times and How to append the 10,000 datasets
To: "haiyan chen" <email@example.com>
Friday, October 9, 2009, 10:23 AM
My vote goes for 'rewrite the original program to generate 10,000 observations' ... obviously depending on the original program, but odds are you can do it using BY group processing.
On Fri, Oct 9, 2009 at 9:17 AM, haiyan chen <firstname.lastname@example.org> wrote:
I have a SAS program whose final outcome is a dataset with one variable and one observation. I then want repeat the program 10,000 times and I want to combine the 10,000 datasets into one dataset with one variable and 10,000 observations.
I know the most inefficient way to do it is to run a macro 10,000 times and then use data step with set statement.
Would someone write an efficient program for me to do it?
Thanks a lot for your help !