Hi,
I have table like as shown below:
Prod_ID | Date | SP | Vol |
101 | 01Jan2015 | 18 | 50 |
101 | 04Jan2015 | 19 | 55 |
101 | 07Jan2015 | 20 | 40 |
101 | 12Jan2015 | 19 | 53 |
101 | 15Jan2015 | 20 | 37 |
101 | 19Jan2015 | 18 | 52 |
101 | 24Jan2015 | 19 | 54 |
101 | 25Jan2015 | 21 | 32 |
101 | 29Jan2015 | 18 | 51 |
101 | 31Jan2015 | 20 | 42 |
102 | 01Jan2015 | 9 | 40 |
102 | 04Jan2015 | 10 | 35 |
102 | 07Jan2015 | 8 | 45 |
102 | 12Jan2015 | 7 | 44 |
102 | 15Jan2015 | 9 | 42 |
102 | 19Jan2015 | 11 | 39 |
102 | 24Jan2015 | 8 | 48 |
102 | 25Jan2015 | 11 | 41 |
102 | 29Jan2015 | 9 | 45 |
102 | 31Jan2015 | 10 | 36 |
Now i need to calculate price change and volume change:
The formula used to calculate the percentage change in SP is:
Price Change= [SP(NEW) - SP(OLD)] / SP(OLD)
The formula used to calculate the percentage change in Vol is:
Volume Change=[Vol(NEW) - Vol(OLD)] / Vol(OLD)
Elasticity= Price Change/Volume Change
So my result should be:
Prod_ID | Date | SP | Vol | Price Change | Volume Change | Elasticity |
101 | 01Jan2015 | 18 | 50 | 0 | 0 | 0 |
101 | 04Jan2015 | 19 | 55 | 0.055555556 | 0.1 | 1.8 |
101 | 07Jan2015 | 20 | 40 | 0.052631579 | -0.272727273 | -5.181818182 |
101 | 12Jan2015 | 19 | 53 | -0.05 | 0.325 | -6.5 |
101 | 15Jan2015 | 20 | 37 | 0.052631579 | -0.301886792 | -5.735849057 |
101 | 19Jan2015 | 18 | 52 | -0.1 | 0.405405405 | -4.054054054 |
101 | 24Jan2015 | 19 | 54 | 0.055555556 | 0.038461538 | 0.692307692 |
101 | 25Jan2015 | 21 | 32 | 0.105263158 | -0.407407407 | -3.87037037 |
101 | 29Jan2015 | 18 | 51 | -0.142857143 | 0.59375 | -4.15625 |
101 | 31Jan2015 | 20 | 42 | 0.111111111 | -0.176470588 | -1.588235294 |
102 | 01Jan2015 | 9 | 40 | 0 | 0 | 0 |
102 | 04Jan2015 | 10 | 35 | 0.111111111 | -0.125 | -1.125 |
102 | 07Jan2015 | 8 | 45 | -0.2 | 0.285714286 | -1.428571429 |
102 | 12Jan2015 | 7 | 44 | -0.125 | -0.022222222 | 0.177777778 |
102 | 15Jan2015 | 9 | 42 | 0.285714286 | -0.045454545 | -0.159090909 |
102 | 19Jan2015 | 11 | 39 | 0.222222222 | -0.071428571 | -0.321428571 |
102 | 24Jan2015 | 8 | 48 | -0.272727273 | 0.230769231 | -0.846153846 |
102 | 25Jan2015 | 11 | 41 | 0.375 | -0.145833333 | -0.388888889 |
102 | 29Jan2015 | 9 | 45 | -0.181818182 | 0.097560976 | -0.536585366 |
102 | 31Jan2015 | 10 | 36 | 0.111111111 | -0.2 | -1.8 |
I also have doubt whether this is the approach to do price elasticity? Please share your thoughts on this
Thanks
Ganesh K
What is your question? Do you need help implementing the formula's in SAS? Or with the methodology of your problem, which would be considered out of scope for this forum.
I am familiar with these concepts . data have; infile cards truncover expandtabs; input Prod_ID Date : $20. SP Vol; cards; 101 01Jan2015 18 50 101 04Jan2015 19 55 101 07Jan2015 20 40 101 12Jan2015 19 53 101 15Jan2015 20 37 101 19Jan2015 18 52 101 24Jan2015 19 54 101 25Jan2015 21 32 101 29Jan2015 18 51 101 31Jan2015 20 42 102 01Jan2015 9 40 102 04Jan2015 10 35 102 07Jan2015 8 45 102 12Jan2015 7 44 102 15Jan2015 9 42 102 19Jan2015 11 39 102 24Jan2015 8 48 102 25Jan2015 11 41 102 29Jan2015 9 45 102 31Jan2015 10 36 ; run; data want; set have; by Prod_ID; PriceChange=(SP-lag(SP))/lag(SP); VolumeChange=(Vol-lag(Vol))/lag(Vol); Elasticity= PriceChange/VolumeChange; if first.Prod_ID then do; PriceChange=0; VolumeChange=0; Elasticity=0; end; run;
Hi Ksharp,
Thanks for code. I need to know is this the method used to arrive Price elasticity? Since i am new to work on this concept. I went through this link : http://support.sas.com/rnd/app/examples/ets/simpelast/sas.htm
Do i need to consider some of other factor?
Overall i want to know how to arrive Price elasticity?
Thanks,
Ganesh K
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.