BookmarkSubscribeRSS Feed
mrahouma
Obsidian | Level 7

 

 

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;

 

image.png

1 REPLY 1

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 994 views
  • 0 likes
  • 2 in conversation