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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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