Conditional Processing
and Exporting Data
STAT 342 – Fall 2020 Tutorial – 7
President Dataset
President Data: Consists of 8 variables and 44 rows in a tab
delimited text file
• Full Name of the president (max no of characters 22) • City (max no of characters 18)
• State (max no of characters 20)
• Age (age when became the president)
• Date of birth (mm/dd/yyyy)
• Term
• Number of votes obtained (comma separated, 10 characters) • Percentage of Vote (6 characters altogether)
Answer following questions.
1. Read the data set into SAS environment using appropriate input style(s).
2. With Age variable create a new variable (Age_Ind) to which indicate whether became a president before 50 years of age (category 1), from 50-60 (category 2) and after 60 (category 3) and using the Age_Ind create a frequency table.
3. Find subsets of data from Presidents data which show presidents from Virginia and save is as a text files.
4. Find presidents from states that begin with “V” and save it as a text file will comma delimiter.
5. Create a csv file with presidents having more than 10 million votes.
6. Create an excel file with presidents who won the presidency with less 50% of votes
7. Create the same file without missing values in the date