Hi,
I have only beginning inventory for day 4.03.2017 and no ending inventory. I am able to calculate ending inventory for this daybased on the beginning invory for this day and other variables that I have. But here where the problem ibegions....I need SAS to use calculated ending inventory value from the day 4.03.2017 and have this equal to beginning inventory for dat 4.04.2017 and so on.
I am not sure where toe ven begin.
Thank you,
mag
In your data step
prev_ending=lag(ending_inventory);
if missing(beginning_inventory) then beginning_inventory=prev_ending;
Do yourself a huge favor and make any dates numeric and apply datetime formats to them, rather than having dates as character variables.
It really helps to provide some example data and the desired result from that sample data.
Also, are your dates actual SAS date values or character?
Hi,
The formats: plan-character, week-character, beginning_inventory, usage and orders are nuemrical.
Example of data:
Plant Week beginning_Inventory usage orders ending inventory (has to be calculated....)
h 01/14/2017 30 5 22
a 01/21/2017 .
b 01/29/2017 .
I need to calculate ending inventory: ending_inventory=beginning_inventory-usage+orders.
So for the first week it is easy to get ending_inventory whihc is 30-5+22=47 now this ending inventory from the week 01/14/2017 needs to become my beginning inventory for the week 01/29/2017 an so on...
Any idea how to approach this problem?
Thank you so much.
In your data step
prev_ending=lag(ending_inventory);
if missing(beginning_inventory) then beginning_inventory=prev_ending;
Do yourself a huge favor and make any dates numeric and apply datetime formats to them, rather than having dates as character variables.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.