BookmarkSubscribeRSS Feed
pearsoninst
Pyrite | Level 9
Thanks Reinhard, i corrected it .
3 REPLIES 3
pearsoninst
Pyrite | Level 9
/*Question:50 students 40 male ,10 Female you select 5 person what is the probability 4 will be male */
/*x = success.N = Population . R = Number of total x in N (Out of total population 50 ,Male is 40 and Female is 10. n = select */ data prob; /* PDF ('HYPER', x, N, R, n <, o>) */ Proba = PDF('HYPER',4,50,40,5); proc Print; run; /* 5 selected 4 will be female */ data prob; /* PDF ('HYPER', x, N, R, n */ Proba = PDF('HYPER',4,50,10,5); proc Print; run;
FreelanceReinh
Jade | Level 19

The question in line 1 is: "... what is the probability 4 will be male".

The answer (0.431337...) could be obtained with this one-liner:

%put %sysfunc(pdf(HYPE,4,50,40,5));

But in fact I, too, would be more interested in the question you switched to: what the chances are that "4 will be female.Smiley Happy (The result is less pleasing, though: only 0.003964...)

 

Did you perhaps intend to calculate PDF('HYPER',4,50,40,5) in the first of the two data steps?

Rick_SAS
SAS Super FREQ

I'm not sure wqhat your question is.  If you want to learn about how to simulate data from the hypergeometric distribution in SAS, see the article "Balls and urns: Discrete probability functions in SAS"

 

If you want to ask about how to compute probabilities for various scenarios, see "Four essential functions for statistical programmers."

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 1920 views
  • 1 like
  • 3 in conversation