Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started