1. Writing Observations Explicitly
The data set orion.discount contains information about various discounts that Orion Star runs on its products.
Partial orion.discount
Start_ Unit_Sales_
Product_ID Date End_Date Price Discount
210100100027 01MAY2011 31MAY2011 $17.99 70%
210100100030 01AUG2011 31AUG2011 $32.99 70%
210100100033 01AUG2011 31AUG2011 $161.99 70%
210100100034 01AUG2011 31AUG2011 $187.99 70%
210100100035 01MAY2011 31MAY2011 $172.99 70%
a. Due to excellent sales, all discounts from December 2011 are repeated in July 2012. Both the December 2011 and the July 2012 discounts are called the Happy Holidays promotion.
• Create a new data set named work.extended that contains all discounts for the Happy Holidays promotion.
• Use a WHERE statement to read-only observations with a start date of 01Dec2011.
• Create a new variable, Promotion, which has the value Happy Holidays for each observation.
• Create another new variable, Season, that has a value of Winter for the December observations
• Use an explicit OUTPUT statement to write the December observations.
• Specify a new start date of 01Jul2012 and an end date of 31Jul2012 for the July 2012 discounts.
• For the July observations, overwrite value for Season with Summer.
• Use an explicit OUTPUT statement to write the July observations.
• Drop the Unit_Sales_Price variable.
!Use the date constant to subset
b. Print the new data set.
• Add an appropriate title
• Verify the results.
Partial PROC PRINT (332 Total Observations)
Start_
ObsProduct_ID Date End_Date Discount Promotion Season
1 210200100007 01DEC2011 31DEC2011 50% Happy Holidays Winter
2 210200100007 01JUL2012 31JUL2012 50% Happy Holidays Summer
3 210200300013 01DEC2011 31DEC2011 50% Happy Holidays Winter
4 210200300013 01JUL2012 31JUL2012 50% Happy Holidays Summer
5 210200300025 01DEC2011 31DEC2011 50% Happy Holidays Winter