Assignment_2_ANSWERS - UNSW SCHOOL OF MATHEMATICS MATH2871...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
UNSW SCHOOL OF MATHEMATICS MATH2871 DATA MANAGEMENT FOR STATISTICAL ANALYSIS ASSIGMENT 2 – ANSWERS 1. [8 marks] SAS code –This is just one way of coding for Q1. Any alternative code will be accepted. data LoMarLoPer HiMarShPer; infile 'P:\MATH2871_2010\Assignment2\prices.dat' dlm = '*' missover ; input ProductID StartDate : date9. EndDate : date9. UnitCostPrice : dollar8.2 UnitSalesPrice : dollar8.2 ; if UnitSalesPrice eq . then UnitSalesPrice=UnitCostPrice* 2 ; label ProductID = 'Product ID' StartDate= 'Start of * Date Range' Income= 'Minimum*Net Income' ; format StartDate ddmmyy10. ; if EndDate<mdy(month(StartDate),day(StartDate),year(StartDate)+ 15 ) and (UnitSalesPrice-UnitCostPrice)/UnitSalesPrice> .55 then do ; Income=(year(EndDate)-year(StartDate)+ 1 )* 100 *(UnitSalesPrice-UnitCostPrice); output HiMarShPer; end ; /* alternative expression*/ /*if EndDate-StartDate<(365*15) and (UnitSalesPrice-UnitCostPrice)/UnitSalesPrice>.55 then do; */ /*MinProfit=(year(EndDate)-year(StartDate))*100*(UnitSalesPrice-UnitCostPrice); */ /*output HiMarShPer; end;*/ else if EndDate>mdy(month(StartDate),day(StartDate),year(StartDate)+ 15 ) and (UnitSalesPrice-UnitCostPrice)/UnitSalesPrice< .55 then do ; Income=(year(EndDate)-year(StartDate)+
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Assignment_2_ANSWERS - UNSW SCHOOL OF MATHEMATICS MATH2871...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online