LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
              10,000  datasets
Comments: To: Joe Matise <>
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.

Thanks. Haiyan

--- On Fri, 10/9/09, Joe Matise <> wrote:

From: Joe Matise <> Subject: Re: How to repeat a program 10,000 times and How to append the 10,000 datasets To: "haiyan chen" <> Cc: Date: 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 <> wrote:

Hello, SAS-L

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 !


Back to: Top of message | Previous page | Main SAS-L page