Hello All,
I have one issue PF the Below Explanation.
Please suggest me how to do it in SASVA.
I have week wise average purchase price of Raw material.
Exp: Now I want to calculate current week Avg Purchase Price - Last week Average Purchase Price.
Week Avg Prucase Price Required Column
1 180 .
2 175 -5
3 185 10
4 168 -17
5 190 22
6 187 -3
I have week and Avg Price, I want to calculate Required Column ( Current Week Avg P Price - Last Week Avg P Price).
Thanks in Advance
Jim.....
Do you have dates against your data?
If so you could look at the periodic operators
You could have two aggregated measures, one for current week and another for week -1
Hi Jim,
I don't think this can be done in the VA expression builder, but it should be possible for you to precalculate these values as part of your data query.
I hope that helps,
Sam
Hi Jim,
If you only want to display simply one selected week at a time you can. This will require using calculated items and probably play with parameters to allow you to select the desired week. Your final list table would be something like this:
Week PurchasePrice_currentweek PurchasePrice_previousweek RequiredColumn
6 187 190 -3
the variables definitions:
PurchasePrice_currentweek
if week='week_parameter'p
return 'Purchase Price'
else 0
PurchasePrice_previousweek
if week='week_parameter'p-1
return 'Purchase Price'
else 0
RequiredColumn
PurchasePrice_currentweek-PurchasePrice_previousweek
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.