Question: how to get the sas code of this question The dataset Musial.s 4 1 contains information about the baseball games that Musial played from September

how to get the sas code of this question The dataset Musial.s41 contains information about the baseball games that Musial played from September 17 through 28 in 1941.
\table[[Obs,Date,Opp,Game_Result,Plate_Appearances,Runs,Hits,Home_Runs,Runs_Batted_In,Field_Position],[1,09/17/1941,Boston Braves,W.3-2,4,0,2,0,2,RF],[2,09/18/1941,Boston Braves,L,1-4,4,0,1,0,0,RF],[3,09/19/1941,Chicago Cubs,W,3-1,4,0,3,0,1,RF],[4,09/20/1941,Chicago Cubs,L,3-7,1,0,0,0,0,PH],[5,09/21/1941,Chicago Cubs,W,6-5,5,1,4,0,0,LF],[6,09/21/1941,Chicago Cubs,W,7-0,5,0,2,0,0,RF],[7,09/23/1941,Pittsburgh Pirates,L,0-4,4,0,0,0,0,RF],[8,09/23/1941,Pittsburgh Pirates,W,9-0,5,3,3,1,2,RF],[9,09/24/1941,Pittsburgh Pirates,W,4-0,5,1,1,0,1,RF],[10,09/25/1941,Pittsburgh Pirates,L,1-3,4,1,2,0,0,RF],[11,09/27/1941,Chicago Cubs,L,5-6,4,1,1,0,1,LF],[12,09/28/1941,Chicago Cubs,W,3-1,4,1,1,0,0,LF]]
Write a SAS data step (no more than 10 lines of code) that incorporates each of the following.
a. Creates a new dataset in the WORK library called "Musial41", beginning with the dataset above.
b. The new dataset should have these five variables Date, Opp, Field_Position, Scoring (which should be the total number of Runs and Runs_Batted_In), and Ratio which should be the Scoring dived by the number of Plate_Appearances for each game.
c. Shortens the Opp variable to the City name using an appropriate function to do so.
d. Displays the Date in the form "21SEP1941" and the Ratio to 2 decimal places.
how to get the sas code of this question The

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!