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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register 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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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