1 when using pointer control to read data in fixed columns


Knowledge Questions

1. When using pointer control to read data in fixed columns, the _____ symbol moves the pointer to a specific column? This method is considered _____________ pointer control.

2. When using pointer control to read data in fixed columns, the _____ symbol moves the pointer over a specific number of columns? This method is considered _____________ pointer control.

3. When used during a data step, the _______ statement selects specific variables to include in the output SAS dataset, while the _____ option in the SET statement selects specific variables to be read in from the input SAS dataset.

4. Using Label and Format statements during a data step ___________ assigns these attributes to variables, while using these statements during PROC PRINT __________ assigns these attributes to variables.

5. There are three statements that can be used to eliminate specific observations during a data step. These are the __________ statement, the __________ statement and the __________ statement.

Programming Assignment
1. Concatenating SAS Data Sets

The goal is to create a second-quarter data set for International Airlines' Vienna hub. Write a data step that combines target information for April, May, and June into one data set. This data is currently stored in separate data sets by month as follows:
· ia.aprtarget
· ia.maytarget
· ia.juntarget
a. As a first step, browse the descriptor portion of each data set to determine the number of observations, as well as the number of variables and their attributes. How many observations does each data set contain?
· ia.aprtarget _____
· ia.maytarget _____
· ia.juntarget _____
What are the names of the variables in each data set?
ia.aprtarget _____________________________________________________
ia.maytarget
___________________________________________________
ia.juntarget
________________________________________________

b. Now write a data step to concatenate the three data sets and create a new data set called work.q2vienna. Use the RENAME= option of the Set statement to rename any variables necessary to combine the datasets.

c. Browse the SAS log. There should be no warning or error messages.
· How many observations are written to the new data set?
· How many variables does the new data set contain?
d. Submit a PROC PRINT step to verify the data.
e. Now modify the DATA step to create two new variables: TotalTar and TotalRev.
· TotalTar is the total targeted number of economy and first class passengers.
· TotalRev is the total revenue expected from economy and first class passengers.
Keep only the variables FlightID, Destination, Date, TotalTar, and TotalRev.
Submit a PROC PRINT step to verify the data.

2. Merging SAS Data Sets
The weather in Birmingham, Alabama on December 15, 1999, might have caused some customers to alter their shipping plans. Investigate how much cargo revenue was lost on all flights out of Birmingham by comparing the targeted revenue with the actual revenue.

a) Sort the data set ia.target121999 into a temporary data set called work.sort_b. Sort by the variable FlightID. Use the WHERE statement to create a subset for Birmingham on December 15, 1999. where Date='15dec1999'd and Origin='BHM';

b) Sort the data set ia.sales121999 into a temporary data set called sort_s. Sort by the variable FlightID. Use the WHERE statement to create a subset for Birmingham on December 15,1999. where Date='15dec1999'd and Origin='BHM';

c) Create a new temporary data set called compare by merging the sort_b and sort_s data sets by the variable FlightID. Subtract CargoRev from CargoTarRev to create a new variable called LostCargoRev.

d) Print the merged data set compare (print only the variables CargoTarRev, CargoRev, and LostCargoRev) and label the LostCargoRev variable. Format the LostCargoRev variable with a dollar sign and two decimal digits.

3. Creating Frequency Reports
a. Use PROC FREQ to create a report using the data1.sanfran data set that displays the frequency count for each Destination, and a separate frequency count for each DepartDay. Add an appropriate title to each frequency table. Your output should look like this:
SAS Output

b. You can specify many options in the TABLES statement to control the calculations and appearance of
a frequency table. The NOCUM option suppresses the printing of the cumulative frequencies and cumulative percentages. Modify the program from Exercise 1.a above to repeat the frequency tables,  but without the cumulative frequencies. Part of your output will look like this:

Partial SAS Output
c. Use PROC FREQ to create a two-way frequency table using the data1.sanfran data set that displays the frequency count for each Destination by DepartDay combination.

SAS Output
4. Validating Data with PROC FREQ
a. PROC FREQ is useful in checking the validity and completeness of data (i.e., invalid values stand out). Use PROC FREQ to check the validity of the variables Gender and JobCode in the data1.mechanics data set.
1) What do you notice about the values of the variable Gender?
2) What do you notice about the values of the variable JobCode?
b. Modify the previous report to display the frequency count for each Gender by JobCode. What are the JobCode values for the invalid values of Gender? (The output is not shown because it provides the answer.)

5. Creating Basic Summary Statistics
a. Generate a PROC MEANS report using the data1.sanfran data set as input to display statistics for the variables CargoRev and TotPassCap only. Remove any titles currently in effect.
b. Modify the previous report to display the data for each Destination (note: you do NOT need to sort the sanfran dataset to do this). Include the following statistics (number of observations, mean, median, mode, range and standard deviation. Limit all output to two decimal places.

Partial SAS Output (not all statistics are shown)

c. Modify the previous report to display the data for each Destination (note: you do NOT need to sort the sanfran dataset to do this). Limit the statistics to number of observations, mean and standard deviation. Limit all output to two decimal places.

6. Creating a One-Dimensional Frequency Table

Use PROC TABULATE and the data1.employees data set to produce a summary report that displays a frequency count for the variable Division with an appropriate title.

7. Creating a Two-Dimensional Frequency Table
Modify the previous report to do the following:

  •  Use a WHERE statement to display only divisions that have the word OPERATIONS in the name
  •  display the variable City in the row dimension
  •  add row and column totals
  • add an appropriate title

8. Creating a Summary Table on an Analysis Variable - Modify the previous report to do the following:

  •  display the mean of the variable Salary in the column dimension
  • display the overall mean of the variable Salary in the column dimension (Use the ALL option)
  •  display the data with dollar signs, commas, and two digits after the decimal point
  • add an appropriate title

Request for Solution File

Ask an Expert for Answer!!
Basic Statistics: 1 when using pointer control to read data in fixed columns
Reference No:- TGS01400008

Expected delivery within 24 Hours