BookmarkSubscribeRSS Feed
lueryy2000
Calcite | Level 5
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
7 REPLIES 7
ballardw
Super User
It might help to show what you've attempted.
lueryy2000
Calcite | Level 5
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
RickM
Fluorite | Level 6
The probnorm function returns the CDF, try using pdf('normal',z).

Good luck!
lueryy2000
Calcite | Level 5
I am sorry I don't get it. Is there a function that return the pdf? Thanks.
lueryy2000
Calcite | Level 5
Sorry I just figured it out. It gives the perfect curves as I thought to be.
Thanks you very much!
Lu
Ksharp
Super User
how about it:
[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
lueryy2000
Calcite | Level 5
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2051 views
  • 0 likes
  • 4 in conversation