BACHELOR OF SCIENCE (HONS.) STATISTICS
COURSE CODE:
SAS PROGRAMMING (STA610)
TOPIC:
EXERCISES CHAPTER 9
NAME:
NUR HUSNINA BINTI ZAMZURI
STUDENT ID:
2023376445
GROUP:
CDCS241 4B
LECTURER NAME:
DR. SHAMSIAH BINTI SAPRI
, Chapter 9.1
Level 2
Q2.
a. Write DATA step that reads orion.customer to create work.birthday.
b. Create 3 variables: Bday2012, BdayDOW2012, and Age2012
• Bday2012 is combination of the month of Birth_Date, the day of Birth_Date and
the constant of 2012 in MDY function.
• BdayDOW2012 is the day of the week of Bday2012.
• Age2012 is the age of the customer in 2012. Subtract Birth_date from
Bday2012 and divide the result by 365.25.
c. Include only: Customer_Name, Birth_Date, Bday2012, BdayDOW2012, Age2012.
d. Format Bday2012 to appear in the form 01Jan2012. Age2012 Should be formatted with
no decimal places.
e. Write PROC PRINT step to create report below. Contain 77 observations.
libname orion "C:\Users\ASUS\OneDrive - Universiti Teknologi
MARA\Desktop\STA610\P1 2017 Data";
data work.birthday;
set orion.customer;
Bday2012=mdy(month(Birth_Date),day(Birth_Date),2012);
BdayDOW2012=weekday(Bday2012);
Age2012=(Bday2012-Birth_Date)/365.25;
keep customer_name birth_date bday2012 bdaydow2012 age2012;
format bday2012 DATE9. age2012 3.;
run;
proc print data=work.birthday;
run;