BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Stepik
Obsidian | Level 7

Team, I tri to use the formula for calculating:

G = QUANTILE('NORMAL', pd). pd has different values, also of 1.

 

Unfortunately, the log gives me the next error

Stepik_0-1688644020680.png

 

Does this mean that the function can not provide inverse cumulative distribution function of a real number?

 

Stepik

1 ACCEPTED SOLUTION

Accepted Solutions
Stepik
Obsidian | Level 7

Solved taking pd=1 separately

View solution in original post

7 REPLIES 7
Stepik
Obsidian | Level 7
of a real number = 1
Ksharp
Super User

Your argument of QUANTILE() is not right .

since it is a P value, it should be (0,1).

 

data have;
input pd;
cards;
.1
.2
.3
.4
;


data _null_;
set have;
G = QUANTILE('NORMAL', pd);
put G= pd=;
run;
38   ;
39
40
41   data _null_;
42   set have;
43   G = QUANTILE('NORMAL', pd);
44   put G= pd=;
45   run;

G=-1.281551566 pd=0.1
G=-0.841621234 pd=0.2
G=-0.524400513 pd=0.3
G=-0.253347103 pd=0.4
NOTE: 从数据集 WORK.HAVE. 读取了 4 个观测
NOTE: “DATA 语句”所用时间(总处理时间):
      实际时间          0.01 秒
      CPU 时间          0.00 秒

Stepik
Obsidian | Level 7

Solved taking pd=1 separately

Ksharp
Super User

Sorry. I have to leave now. I will take a look tomorrow.

But maybe @Rick_SAS  could give you a hand. He is good at this.

Ksharp
Super User
And also better post sas dataset " R.Cov" . As I said you can't have pd_ap=1 in it.
FreelanceReinh
Jade | Level 19

Hello @Stepik,

 

I think you just need to handle the cases pd=0 and pd=1 separately in the calculation of G and N:

 

if pd in (0 1) then N=pd;
else do;
  G = QUANTILE('NORMAL', pd); 
  N = CDF('NORMAL', G/SQRT(1-R)+SQRT(R/(1-R))*QUANTILE('NORMAL',0.999));
end;

 

 

Alternatively, since N=pd implies RWA1=0, you can also put the entire block of your assignment statements into the ELSE branch:

 

if pd in (0 1) then RWA1=0;
else do;
  ... your code ...
end;

(before the RETURN statement).

 

Stepik
Obsidian | Level 7
I did it separately indeed for pd=1. thanks

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1777 views
  • 3 likes
  • 3 in conversation