代写 SAS Name:________________________________ 2018 STAT 3094: SAS Base Programming InClass #01 (Worth 100 points)

Name:________________________________ 2018 STAT 3094: SAS Base Programming InClass #01 (Worth 100 points)
Instructions
This assignment is due at the end of class in the form of a SAS program called LastNameFirstInitial_IN1.SAS (EG. SmithE_IN1.SAS). You can collaborate with your team members. Submit the program in your CANVAS Drop Box by the end of class.
In this exercise we will learn
1. How to create a permanent data set
2. Use proc contents to obtain information about variables on the data set 3. Use keep and drop
Use the following scenario to answer the questions.
Below is a sample of flights that will run on Saturdays and Sundays through International Airlines. Download (save on your flashdrive) the SAS program IN_1.SAS from canvas/resources/inclass. Open the SAS program IN_1_2018.SAS (either double click on the program or use file>open). The dataset contains the number of passengers expected to fly first class and economy class, and how much revenue the airline is expected to bring in from those flights.
Fl_num Dest Date_flight Time_of_day Num_fc Num_ec Fc_revenue Ec_revenue
IA6100 FRA IA5915 FRA IA0720 LAX IA0506 IAD IA0794 ORD IA0130 MIA
15AUG2017 1 14AUG2017 3 14AUG2017 2 15AUG2017 3 14AUG2017 1 15AUG2017 2
14 100 15 110 885 670 880 885
$3,328.00 $2,756.00 $2,458.00 $2,226.00 $2,038.00 $3,105.00
$14,580.00 $16,335.00 $9,110.00 $5,108.00 $7,746.00 $8,628.00
1.
2.
Place a comment at the beginning of the SAS code stating your name. Then place a comment on the next line stating “In Class Assignment 1”. Then, on another line, “comment” that this dataset “Represents a sample of flights”. Place a comment before each one of your code solutions to state “Problem X solution”. (When there is no code, just comment that and what you did. For eg: “Created a temporary SAS dataset in the WORK library by running the code )
Save this dataset as a temporary SAS dataset (run the code). Name this SAS dataset augtarget.
a. Add a line after the data step run statement: proc contents; run; Execute the code and copy the results to word file (be sure to add the same material at the top – name, etc.).
b. Why are two revenue variables needed on the data set (what is the difference between
FC_revenue and FC_revenue2)?
c. Most procedures have options. Run proc contents varum; run; How does this change
the output relative to (a)? What is the type for “Time of day”?
d. how many numeric variables are there in this dataset
e. how many character variables are there in this dataset?
Create a new data set (use the same data set name). Convert (ie read) the ‘Time_of_day’ SAS variable into a SAS character variable. Create a new variable total_revenue that is the sum of Ec and Fc revenues2. What happens if you try to do this with Fc_revenue and Ec_revenue?
3.

4. Create a library called ia. Transform the temporary SAS dataset from Problem 3 into a permanent SAS dataset. Drop the Dest, Fc_revenue2 and Ec_revenue2 variables from this data set (Find out how to “Drop” a variable) and store this dataset at a location of your choice on your flashdrive.
5. Create another permanent SAS dataset in the ia library called flight_info that only keeps the flight number, destination, total_revenue and the date of the flight. (find out how to “keep” a variable)
6. Print the flight_info SAS dataset in the output window.
NOTE: please just submit to CANVAS the SAS program with relevant information. Do not hand in the output file.