I have a big store sales dataset and we may hear about marketing trick; the stores raise their prices when they have big discount rates on holiday sales. I want to investigate if this is true.
I used the following code but I realized that the results are weired as it gave me "marketing trick"=1 although I did not see any diference in the Price_ignore_discount and orig_pricePerUnit (see screenshot), any advice will be greatly appreciated.
proc sort data=Superstore_Orders1 ; by Product_ID ;run;
** Identiy if there is difference between the original unit price vs unit price excluding discount to assess if marketing trick is correct;
data orig_price; set Superstore_Orders1;
orig_pricePerUit= Unit_price;
where discount=0; run;
**merge both based on product_ID;
proc sort data=Superstore_Orders1; by product_ID; proc sort data=orig_price; by product_ID; run;
data Superstore_Orders1_merg; merge Superstore_Orders1 orig_price(in=i); by product_ID; if i;
Price_ignore_discount= Unit_price+(orig_pricePerUit* Discount ); run;
data Superstore_Orders1_merg1; set Superstore_Orders1_merg;
if Price_ignore_discount GT orig_pricePerUit then marketing_trick=1; else marketing_trick=0; run;
Please post example data in usable form (data step with datalines), so we have something to play around with.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: