LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (October 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 15 Oct 2009 09:58:50 +0200
Reply-To:     Anders Mørup Jensen <amo@SSI.DK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Anders Mørup Jensen <amo@SSI.DK>
Organization: TDC Totalloesninger
Subject:      Re: how to simulate clinical trial data which has lognormal
Comments: To: sas-l@uga.edu

As I understand the OP, he wanted the lognormal sample to have Mean=2 and Std=1 (not the underlying normal distribution).

With a litle algebra applied to wellknown formulas for the mean and variance of a lognormal distribution (see e.g. Wikipedia) this means that the underlying normal distribution should have:

Mean value = 2*log(2) - log(5)/2 Variance = log(5/4);

resulting in the need1 dataset below.

data need; /* ynorm has mean 2 and standard deviation 1 */

do i=1 to 200; ynorm=rannor(0)+2; ylognorm=exp(ynorm); output; end; run;

proc means data=need; var ylognorm; run;

data need1; /* ylognorm has mean 2 and standard deviation 1 */

do i=1 to 20000; ynorm=sqrt(log(5/4))*rannor(0)+(2*log(2)-log(5)/2); ylognorm=exp(ynorm); output; end; run;

proc means data=need1; var ylognorm; run;

/ Anders

"Ya Huang" <ya.huang@AMYLIN.COM> skrev i en meddelelse news:200910142008.n9EF4ebt011509@malibu.cc.uga.edu... > /* If X is a random variable with a normal distribution, > then Y = exp(X) has a log-normal distribution; > likewise, if Y is log-normally distributed, > then log(Y) is normally distributed. */ > > data need; > do i=1 to 200; > ynorm=rannor(0)+2; > ylognorm=exp(ynorm); > output; > end; > run; > > ods listing close; > ods pdf file="c:\temp\junk.pdf"; > > goptions reset=all device=sasprtc; > > proc gchart data=need; > vbar ylognorm; > vbar ynorm; > run; > > ods _all_ close; > > > On Wed, 14 Oct 2009 11:09:48 -0700, jingtailan@gmail.com > <jingtailan@GMAIL.COM> wrote: > >>all: >> >>please advise on >>1. how to use SAS8.2 to create a data set which has >>N=200 >>mean=2 >>std=1 >>distribution=lognormal >> >>2 After creation of these data, what procedure I should use to get PDF >>graph? >> >>thanks a lot. >>jingtailan


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