Scenario 9

Directions

This scenario uses the Cert.Empdata, Cert.Empdatu, and Cert.Empdatu2 data sets. Write a SAS program to do the following:
  • Concatenate Cert.Empdata, Cert.Empdatu, and Cert.Empdatu2 to create Work.FlightEmpData.
  • Create a macro variable named &Location and set the value of this macro variable to USA.
  • Include only the observations whose value for Country is the value of the macro variable.
  • Keep only observations whose salary is $30,000 or greater.
  • Sort the data by variable Salary in descending order.
  • Use PROC EXPORT to export the data to a CSV file and save it as flightempdata.csv.

Test Your Code

  1. What is the value of Salary in observation 4?
  2. What is the size (in bytes) of the CSV file that you exported?

Objectives Accomplished

  • Use a DATA step to create a SAS data set from an existing SAS data set.
  • Create a simple raw data file by using the EXPORT procedure as an alternative to the DATA step.
  • Use the WHERE statement in the DATA step to select observations to be processed.
  • Use the SORT procedure to re-order observations in place or write them out to a new data set.
  • Create macro variables with the %LET statement.
Last updated: February 14, 2019
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset