Docsity

SAS Homework: Data Visualization and Manipulation - Prof. D. E. Holmes, Assignments of Statistics

Toggle sidebar
bg1
1
PSTAT 130 HOMEWORK 8
1. Producing Vertical Bar Charts and Pie Charts
Use the ia.personl date set and a WHERE statement to produce the charts requested below
for the ticket agents (JobCode values of TA1, TA2, and TA3).
where JobCode in ('TA1', 'TA2', 'TA3');
a) Produce a vertical bar chart that displays the number of male and female ticket agents
(Gender values are M and F).
b) Compare the average salaries of each ticket agent job level by showing a solid pie slice for
each of the three Jobcode values. Add an appropriate title that displays the text in red with
the SWISS font.
c) Enhance the pie chart by filling the pie slices with crosshatched lines and exploding the
slice represents the TA3 value of JobCode.
2. Producing a Two-Dimensional Plot
The data set ia.delay contains dates and delays in minutes for International Airlines flights.
Use the data set and an appropriate WHERE statement to select flights to Copenhagen
(Dest='CPH') and produce the plot described below:
• Plot the delays on the vertical axis and dates along the horizontal axis.
• Adjust the scale on the vertical axis to start at –15 and end at 30 with a tick mark every 15
minutes.
• Display the title Flights to Copenhagen in red.
• Display the points as red squares.
• Use the NEEDLE interpolation technique to connect the points to the horizontal axis.
3. Outputting Multiple Observations
Rotating, or transposing, a SAS data set can be accomplished by using explicit OUTPUT statements
in a DATA step. When a data set is rotated, the values of an observation in the input data set become
values of a variable in the output data set.
Use explicit OUTPUT statements to rotate prog2.donate into a data set called rotate. Create
four output observations in rotate from each input observation in prog2.donate.
The rotate data set should have three variables: ID, Qtr, and Amount. Print the data set to verify
your results.
4. Using Conditional Logic to Output Multiple Observations
The prog2.ffmethod data set contains information about the different ways that frequent
flyers purchased airline tickets. A value of Y in the Internet, Telephone, or
TravelAgency variables indicates that the frequent flyer used that method.
prog2.ffmethod
Use explicit OUTPUT statements to create a data set called buyhistory. This data set will
contain one observation for each method used by each frequent flyer. There will be two
pf2

Partial preview of the text

Download SAS Homework: Data Visualization and Manipulation - Prof. D. E. Holmes and more Assignments Statistics in PDF only on Docsity!

PSTAT 130 HOMEWORK 8

1. Producing Vertical Bar Charts and Pie Charts

Use the ia.personl date set and a WHERE statement to produce the charts requested below for the ticket agents ( JobCode values of TA1, TA2, and TA3).

where JobCode in ('TA1', 'TA2', 'TA3');

a) Produce a vertical bar chart that displays the number of male and female ticket agents ( Gender values are M and F). b) Compare the average salaries of each ticket agent job level by showing a solid pie slice for each of the three Jobcode values. Add an appropriate title that displays the text in red with the SWISS font. c) Enhance the pie chart by filling the pie slices with crosshatched lines and exploding the slice represents the TA3 value of JobCode.

2. Producing a Two-Dimensional Plot

The data set ia.delay contains dates and delays in minutes for International Airlines flights. Use the data set and an appropriate WHERE statement to select flights to Copenhagen ( Dest='CPH' ) and produce the plot described below:

  • Plot the delays on the vertical axis and dates along the horizontal axis.
  • Adjust the scale on the vertical axis to start at –15 and end at 30 with a tick mark every 15 minutes.
  • Display the title Flights to Copenhagen in red.
  • Display the points as red squares.
  • Use the NEEDLE interpolation technique to connect the points to the horizontal axis. 3. Outputting Multiple Observations

Rotating, or transposing, a SAS data set can be accomplished by using explicit OUTPUT statements in a DATA step. When a data set is rotated, the values of an observation in the input data set become values of a variable in the output data set.

Use explicit OUTPUT statements to rotate prog2.donate into a data set called rotate. Create four output observations in rotate from each input observation in prog2.donate.

The rotate data set should have three variables: ID , Qtr , and Amount. Print the data set to verify your results.

4. Using Conditional Logic to Output Multiple Observations

The prog2.ffmethod data set contains information about the different ways that frequent

flyers purchased airline tickets. A value of Y in the Internet , Telephone , or

TravelAgency variables indicates that the frequent flyer used that method.

prog2.ffmethod

Use explicit OUTPUT statements to create a data set called buyhistory. This data set will

contain one observation for each method used by each frequent flyer. There will be two

observations in buyhistory that refer to F31351, but only one observation that refers to

F212.

The buyhistory data set should have two variables: ID and Method. Print the data set to verify your results.

5. Writing to Multiple SAS Data Sets

The data set prog2.elements contains information about the known elements on the periodic table. Each observation contains an element's name, symbol, atomic number, and state. The value of State refers to whether the element is a gas, liquid, solid, or synthetic at room temperature.

Create four SAS data sets, gas , liquid , solid , and synthetic. Each data set will contain information about those elements that have that state at room temperature. Each of these four data sets should contain three variables; they should not contain the State variable.

The gas data set should contain 11 observations. The liquid data set should contain 3 observations. The solid data set should contain 78 observations. The synthetic data set should contain 21 observations.

6. Controlling Input and Output Size

Recall that prog2.elements contains information about the known elements on the periodic table. Each observation contains an element’s name, symbol, atomic number, and state. The value of State refers to whether the element is a gas, liquid, solid, or synthetic at room temperature.

Create two SAS data sets, natural and synthetic.

The natural data set will contain information about elements that are solids, liquids, or gases at room temperature. The natural data set will contain three variables, Name , AtomicNum , and State , and 92 observations.

The synthetic data set will contain two variables, Name and AtomicNum , and 21 observations.