Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

-Suppose we evaluate the performance of a player based on the player’s HR and RB

ID: 3171465 • Letter: #

Question

-Suppose we evaluate the performance of a player based on the player’s HR and RBI score. Assume each HR counts as 3 points while each RBI counts as 2 points. Find the playerIDs who have the highest score.

-Select a random sample of size 1000 using simple random sample approach (without replacement), then find the playerIDs who have the higest HR values among the selected sample.

-Create a dataset such that (a) it contains the following variable playerID, yearID, HR, RBI and (b) 1990yearID1999 and HR>5.

It is just idea but I need SAS program code. help me out about codes for these question.

Explanation / Answer

/* Player IDs having highest score*/

proc sql;

Create table temp1 as

select playerIDs,3*sum(HR) as sum_hr,2*sum(RBI) as sum_rbi

from data_set

grop by playerIds;

quit;

data temp2;

set temp1;

total_score = sum_hr+sum_rbi;

run;

proc sort data = temp2 out=temp3;

by total_score descending;

run;

data temp4;

set temp3;

if _N_ = 1;

run;

proc sql;

select playerids into : highest_score_id

from temp4;

quit;

/* selecting sample of size 1000 */

proc sql;

Create table temp1 as

select playerIDs,sum(HR) as sum_hr

from SampleSRS

grop by playerIds;

quit;

proc sort data =temp1 out=temp2;

by sum_hr descending;

run;

data temp3;

set temp2;

if _N_ = 1;

run;

proc sql;

select playerids into : highest_score_id

from temp3;

quit;

/*Create a dataset such that (a) it contains the following variable playerID, yearID, HR, RBI */

/* part (a) */

data reqd_data;

set data_set(keep = playerID, yearID, HR, RBI);

run;

/* part b */

data reqd_data2;

set reqd_data;

if yearID <= 1990 and yearID >=1999 and HR>5;

run;