Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am trying to write a SAS program where I import excel files and create a merge b/w them after finding the average. However, the

I am trying to write a SAS program where I import excel files and create a merge b/w them after finding the average.

However, the code is not averaging all players.

PROC IMPORT DBMS=xlsx OUT=more_rate replace

DATAFILE="/folders/myfolders/sasuser.v94/Baseball_More_Rate.xlsx";

GETNAMES=YES;

RUN;

data rate;

set work.more_rate;

run;

*Find the average OBP for each of the "rate" baseball data;

proc means data = rate noprint;

output out = avg_obp1 mean(OBP) = a_average;

run;

data avg_obp;

merge rate avg_obp1 (drop=_TYPE_ _FREQ_); *Append the data to baseball_more_rate.xlsx;

run;

proc print data = avg_obp;

*******************************************;

PROC IMPORT DBMS=xlsx OUT=more_rate2 replace

DATAFILE="/folders/myfolders/sasuser.v94/Baseball_Min_Rate.xlsx";

GETNAMES=YES;

RUN;

data rate_for_min;

set work.more_rate2;

run;

*Find the average OBP for each of the "rate" baseball data;

proc means noprint data = rate_for_min;

output out = avg_obp2 mean(OBP) = league_avg_obp;

format league_avg_obp 6.4;

run;

data league_avg_obp;

merge rate_for_min avg_obp2 (drop=_TYPE_ _FREQ_); *Append the data to Baseball_Min_Rate.xlsx;

merge rate avg_obp1 (drop=_TYPE_ _FREQ_);

run;

proc print data = league_avg_obp;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Contemporary Business Mathematics With Canadian Applications

Authors: Ali R. Hassanlou, S. A. Hummelbrunner, Kelly Halliday

12th Edition

0135285011, 978-0135285015

More Books

Students also viewed these Mathematics questions