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 total rows and 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; Set the limit to or a higher number.
This allows SAS to display up to error messages in the log
Create a SAS data set named USPresident and
save it in the WEBWORK library
LIBNAME WEBWORK homeusasstudiowebworkRS;
DATA WEBWORK.USPresident;
Read external data from the USPresident.csv file using INFILE
INFILE homeuPresidentDataUSPresidentscsv DELIMITER FIRSTOBS DSD MISSOVER;
INPUT Presidency $ President $ Tookoffice :MMDDYY Leftoffice :MMDDYY Party $ HomeState $ Inofficedays;
LABEL Presidency 'Presidency' President 'President' Tookoffice 'Took Office' Leftoffice 'Left Office' Party 'Party Affiliation' HomeState 'Home State' Inofficedays 'Days in Office';
Calculate the total number of days in office
Inofficedays INTCKdays Tookoffice, Leftoffice;
Include a conditional statement in your code that selects only presidents from Ohio
IF HomeState 'Ohio' THEN OUTPUT;
FORMAT Tookoffice Leftoffice MMDDYY;
RUN;
PROC DATASETS LIBWEBWORK;
CONTENTS DATAUSPresident;
RUN;
Display the first five observations of the dataset for verification
PROC PRINT DATAWEBWORK.USPresidentOBS;
RUN;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
