Question: To practice your skills as a newly hired data analytics developer, you have pulled information from Wikipedia to use as sample data to show president

To practice your skills as a newly hired data analytics developer, you have pulled information from Wikipedia to use as sample data to show president and number of days in office from each state.
Assignment Instructions
In SAS Studio, create a new folder named PresidentData.
Upload the USPresident.csv data file into the PresidentData folder.
Read external data from the USPresident.csv file use INFILE, create a SAS data set named USPresident and save it in the WEBWORK library.
Include a conditional statement in your code that selects only presidents from Ohio. Calculate the total number of days each president was in office. Days in office are calculated using the Took office and left office columns.
Take the following screenshots for submission:
A screenshot of the USPRESIDENTS dataset in the WEBWORK library showing metadata of 44 total rows and 6 total columns.
A copy of your code (text copy).
A screenshot of the RESULTS tab showing Table of Contents.
Include these screenshots in one Word document and be sure to annotate each screenshot.
OPTIONS ERRORS=200; /* Set the limit to 200 or a higher number.
This allows SAS to display up to 200 error messages in the log */
/* Create a SAS data set named USPresident and
save it in the WEBWORK library */
LIBNAME WEBWORK '/home/u63728168/.sasstudio/webwork/RS17574';
DATA WEBWORK.USPresident;
/* Read external data from the USPresident.csv file using INFILE */
INFILE '/home/u63728168/PresidentData/USPresidents.csv' DELIMITER=',' FIRSTOBS=2 DSD MISSOVER;
INPUT Presidency $ President $ Took_office :MMDDYY10. Left_office :MMDDYY10. Party $ HomeState $ In_office_days;
LABEL Presidency = 'Presidency' President = 'President' Took_office = 'Took Office' Left_office = 'Left Office' Party = 'Party Affiliation' HomeState = 'Home State' In_office_days = 'Days in Office';
/* Calculate the total number of days in office */
In_office_days = INTCK('days', Took_office, Left_office)+1;
/* Include a conditional statement in your code that selects only presidents from Ohio */
IF HomeState = 'Ohio' THEN OUTPUT;
FORMAT Took_office Left_office MMDDYY10.;
RUN;
PROC DATASETS LIB=WEBWORK;
CONTENTS DATA=USPresident;
RUN;
/* Display the first five observations of the dataset for verification */
PROC PRINT DATA=WEBWORK.USPresident(OBS=5);
RUN;

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 Databases Questions!