代写 SAS Name:________________________________

Name:________________________________
STAT 3094: SAS Base Programming Homework #02 2018
Instructions
Read Chapter 2 and Chapter 3 from textbook.
Do Chapter 2 and 3 Quizzes and provide the answers. (you can list the answers here such as Ch2: 1A; 2B..etc; Ch3: 1A, 2C.)
Errors in SAS are sometimes difficult to find and understand. For many errors, one can look at the color coding used for the code syntax. A way to improve understanding is to make some and note what the error produces in the log file. The code below might have errors. For each set there is at most one error – run the code, identify the error and look at the log file. Add a comment on the log file and its relationship with the error. How would you correct the code?
Cut and paste the code and log into a word file with solution and upload to SCHOLAR. Note you may have to fix the code in some of these programs before running the next one
/*1 example data set */
title ‘a simple program ;
data one;
input a b;
datalines;
35 7
6 9 11
run;
/*2 example data set */
title ‘a simple program’;
data one;
input a b;
dataline;
35 69
run;
/*3 example data set */
title ‘a simple program ‘;
data one;
input a b;
datalines;
35 69
run;
/*4 example data set */

title ‘a simple program’;
data one;
input a b;
datalines
35
6a
run;
/*5 example data set
title ‘a simple program’;
data one;
input a b
datalines;
35 69
run;
/*6 example data set */
title ‘a simple program ‘
data one;
input a b;
datalines;
35
69
run;
7. Create a permanent SAS dataset called prob4 from the permanent passngrs SAS dataset. Calculate the percentage of seats that were first and economy classes for each flight. Round the answer to four digits after the decimal point. Name these variables p_fclass and p_eclass.
8. a. Sort (use Proc Sort) the prob4 SAS dataset by the departure date and store the sorted data in a temporary SAS dataset called prob5.
b. Then, use PROC PRINT to print the prob5 SAS dataset by departure date.
Sum up the total number passengers that use each class by departure date. Id by FlightID. Apply a format to the departure date such that the dates look like 01/01/1960”.
Apply the PERCENT format to the percent variables.
Apply the DOLLAR format only on the revenue variable.
Copy, paste, and apply the temporary labels that you used in the above exercise. Make the output look pretty. (Hint: to get the format 23.43% you need to use percent8.2 format)