Sentry Page Protection
** Question 1 **;
proc freq data=order order=freq; table product; where time <= '11:00:00't; run; ** Sausage roll is the best-selling product before 11 am. ** Question 2 **; data example; input date1 : date9. date2 : mmddyy10. date3 : ddmmyy10.; format date1 date9. date2 mmddyy10. date3 ddmmyy10.; datalines; 15NOV2018 11/15/2018 15/11/2018 ; run; ** Question 3 **; proc sql; select count(*) as cnt from gym where year(join_date) =2018; run; ** Answer: 91 customers joined the gym in 2018. **; ** Question 4 **; data gym2; set gym; if join_time < '12:00't then flag = "Morn"; else flag = "Aftn"; run; proc freq data=gym2; table flag; run; ** More people joined the gym in the afternoon (217) than in the morning (83). **; ** Question 5 **; data gym3; set gym; if status = "Cancelled" then num_month = intck('month', join_date, end_date, 'cont'); run; proc means data=gym3; var num_month; run; ** On average, memberships last for 11 months. **; |