Contributor
Posts: 49

# How to draw a standard normal denstity curve

Hi all,

I was trying to draw a standard normal density curve using probnorm function. But instead of curvy it is spiky around zero. So is there any way to do it?

Thank you,
Lu
Super User
Posts: 12,148

## Re: How to draw a standard normal denstity curve

It might help to show what you've attempted.
Contributor
Posts: 49

## Re: How to draw a standard normal denstity curve

This is the code I used. It only generate the standard normal pdf alone, which is what i want. But you can see it is spiky instead of curvy around zero. Do you know it there better way to do it?

data try;
do z = -5 to 5 by 0.001;
if z gt 0 then pdf = 1- probnorm(z);
else pdf = probnorm(z);
output;
end;
run;

proc gplot data=try;
plot pdf*z ;
run;

Many thanks,
Lu
Regular Contributor
Posts: 165

## Re: How to draw a standard normal denstity curve

The probnorm function returns the CDF, try using pdf('normal',z).

Good luck!
Contributor
Posts: 49

## Re: How to draw a standard normal denstity curve

I am sorry I don't get it. Is there a function that return the pdf? Thanks.
Contributor
Posts: 49

## Re: How to draw a standard normal denstity curve

Sorry I just figured it out. It gives the perfect curves as I thought to be.
Thanks you very much!
Lu
Super User
Posts: 10,313

## Re: How to draw a standard normal denstity curve

[pre]
data normal;
do i=1 to 10000 ;
normal=rand('normal',0,1);
output;
end;
run;
proc univariate data=normal ;
histogram normal/normal;
run;
[/pre]

Ksharp
Contributor
Posts: 49

## Re: How to draw a standard normal denstity curve

Thanks. But I only want to have the standard normal pdf alone. Do you know if there is better way to do it. Below is my original code:

data try;
do z = -5 to 5 by 0.001;
if z gt 0 then pdf = 1- probnorm(z);
else pdf = probnorm(z);
output;
end;
run;

proc gplot data=try;
plot pdf*z ;
run;

Many thanks,
Lu
Discussion stats
• 7 replies
• 635 views
• 0 likes
• 4 in conversation