Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Creating Formats with Inclusive Ranges from a SAS Data Set The data set orion.ages contains three variables: First_Age, Last_Age, and Description. Partial orion.ages First_ Obs

Creating Formats with Inclusive Ranges from a SAS Data Set The data set orion.ages contains three variables: First_Age, Last_Age, and Description. Partial orion.ages First_ Obs Age Last_Age Description 1 15 30 15-30 years 2 30 45 31-45 years 3 45 60 46-60 years 4 60 75 61-75 years a. Create a format from the orion.ages data set and store it permanently in the orion.MyFmts catalog. Use the appropriate option to view the values in the format. b. Write a DATA step to create a data set named sales that reads the Employee_ID and Birth_Date variables from the orion.sales data set. Create a new variable named Age that is the employee's age as of the current date, and another new variable named Age_Cat that is the value of the variable Age using the AGE format. The YRDIF function with the AGE basis calculates the exact age of the employee with decimal places. c. Print the first five observations of the sales data set to confirm that the new variables were created correctly. PROC PRINT Output (as of July 18, 2012) Sales Data Set Birth_ Obs Employee_ID Date Age Age_Cat 1 120102 11AUG1973 38 31-45 years 2 120103 22JAN1953 59 46-60 years 3 120121 02AUG1948 63 61-75 years 4 120122 27JUL1958 53 46-60 years 5 120123 28SEP1968 43 31-45 years Module 10 - Lesson 2 Creating and Maintaining Permanent Formats 3 Challenge 3. Creating Formats with Exclusive Ranges from a SAS Data Set The data set orion.ages_mod contains three variables: First_Age, Last_Age, and Description. Partial orion.ages_mod First_ Obs Age Last_Age Description 1 15 30 15-29 years 2 30 45 30-44 years 3 45 60 45-59 years 4 60 75 60-75 years a. Create a format named AGES_MOD from the orion.ages_mod data set and store it permanently in the orion.MyFmts catalog. Use the appropriate option to view the values in the format. The value of the Last_Age variable is not to be included in the Description variable. Use SAS Help or SAS OnlineDoc to investigate the EEXCL variable that is required to get the correct results for this exercise. b. Write a DATA step to create a data set named sales that reads the Employee_ID and Birth_Date variables from the orion.sales data set. Create a new variable named Age that is the employee's age as of the current date, and another new variable named Age_Cat that is the value of the variable Age using the AGES_MOD format. One possible solution for calculating Age is to use the YRDIF function with the AGE basis. c. Print the first five observations of the sales data set to confirm that the new variables were created correctly. PROC PRINT Output (as of July 18, 2012) Sales Data Set Birth_ Obs Employee_ID Date Age Age_Cat 1 120102 11AUG1973 38 30-44 years 2 120103 22JAN1953 59 45-59 years 3 120121 02AUG1948 63 60-75 years 4 120122 27JUL1958 53 45-59 years 5 120123 28SEP1968 43 30-44 years

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Statistical Techniques in Business and Economics

Authors: Douglas A. Lind, William G Marchal

17th edition

1259666360, 978-1259666360

More Books

Students also viewed these Mathematics questions