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 (April 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 16 Apr 2007 08:25:03 -0500
Reply-To:     "Huang, JS" <Huang.JS@PRINCIPAL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Huang, JS" <Huang.JS@PRINCIPAL.COM>
Subject:      Re: Simulation Question
Comments: To: "Rahman, Sheikh" <Sheikh.Rahman@ARBELLA.COM>
In-Reply-To:  A<F34B4120297BA14EA45722DF7F8B6FE622E782@INFP62.arbella.com>
Content-Type: text/plain; charset="us-ascii"

Try the following. Change the values of Seed, SetCount and SampleSize if needed.

%let Seed=1234; %let SetCount=100; %let SampleSize=100; %macro randLogNormal(); data Result(keep=count total); call streaminit(&Seed); retain total; %do count=1 %to &SetCount; total=0; %do i=1 %to &SampleSize; total=total+rand('LOGNORMAL'); %end; output; %end; run; proc print data=Result; run; %mend;

%randLogNormal()

***** Output ***** The SAS System 06:45 Monday, April 16, 2007 226

Obs total

1 181.266 2 165.501 3 146.775 4 188.868 5 194.848 6 131.635 7 178.292 8 190.820 9 167.235 10 163.259 11 175.953 12 142.320 13 147.884 14 160.838 15 187.107 16 201.528 17 157.628 18 173.848 19 124.137 20 141.176 21 149.986 22 149.576 23 180.703 24 162.769 25 128.761 26 148.220 27 163.856 28 180.346 29 177.306 30 178.500 31 165.587 32 179.555 33 143.243 34 185.710 35 200.746 36 154.556 37 215.235 38 146.304 39 146.694 40 207.311 41 163.405 42 147.413 43 142.533 44 148.664 45 168.637 46 156.259 47 209.457 48 177.061 49 182.105 50 183.956 51 125.292

The SAS System 06:45 Monday, April 16, 2007 227

Obs total

52 181.037 53 167.496 54 175.591 55 163.985 56 126.462 57 177.813 58 187.965 59 173.144 60 159.298 61 166.919 62 171.591 63 191.766 64 146.076 65 165.985 66 186.930 67 173.944 68 168.950 69 168.672 70 132.819 71 179.522 72 140.808 73 173.132 74 185.672 75 152.159 76 164.042 77 151.990 78 154.270 79 168.029 80 167.202 81 191.849 82 158.552 83 166.059 84 170.807 85 174.842 86 161.922 87 195.871 88 155.284 89 150.707 90 163.654 91 173.828 92 195.357 93 167.289 94 199.363 95 157.600 96 188.391 97 129.355 98 159.946 99 152.914 100 149.781

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Rahman, Sheikh Sent: Monday, April 16, 2007 7:48 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Simulation Question

Hello Everybody!

I have a situation where I have to generate 100 random numbers from a standard lognormal distribution each time and add this numbers. I have to repeat the process 100 times, and each time I have to sum up the numbers.

How can I do this? How can I store the results in a file for further calculations?

Any suggestion/help will be highly appreciated.

-----Message Disclaimer-----

This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to Connect@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation.

Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act ("E-Sign") unless a specific statement to the contrary is included in this message.

While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements.


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