BookmarkSubscribeRSS Feed
almaskaa
Calcite | Level 5

The Question: 

  1. Create a macro to conduct the following analysis:
  • Depending on the user-specified option, compute one of the following estimators for batting average:
    • Maximum Likelihood Estimator (MLE): Pi=xi/n
  • Bayesian Estimator (BE): Screen Shot 2021-11-29 at 10.20.55 PM.png

i already cleaned the data by using data step:

DATA Q1;
input
ID
Name : $14.
TeamandLeague : $21.
BattingAverageFirst45 $
BattingAverageRemainderSeason $
AtBatsRemainderSeason ;
DATALINES;
1 Clemente (Pitts,NL) .400 .346 367
2 F.Robinson (Balt,AL) .378 .298 426
3 F.Howard (Wash,AL) .356 .276 521
4 Johnstone (Cal,AL) .333 .222 275
5 Berry (Chi,AL) .311 .273 418
6 Spencer (Cal,AL) .311 .270 466
7 Kessinger (Chi,NL) .289 .263 586
8 L.Alvarado (Bos,AL) .267 .210 138
9 Santo (Chi,NL) .244 .269 510
10 Swoboda (NY,NL) .244 .230 200
11 Unser (Wash,AL) .222 .264 277
12 Williams (Chi,AL) .222 .256 270
13 Scott (Bos,AL) .222 .303 435
14 Petrocelli (Bos,AL) .222 .264 538
15 E.Rodriguez (KC,AL) .222 .226 186
16 Campaneris (Oak,AL) .200 .285 558
17 Munson (NY,AL) .178 .316 408
18 Alvis (Mil,NL) .156 .200 70
;
RUN;
PROC PRINT data=Q1;
RUN;

 

I dont know the conditions im supposed to write if i use the %if %then %else method. 

can anyone help me in solving this question?

 

 

 

2 REPLIES 2
andreas_lds
Jade | Level 19

The macro language mainly exists to generate sas code, avoiding repetitive work.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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