New Contributor
Posts: 2

# How to model a dynamic process with changing inventory?

I have a question regarding the coding on my dissertation project, I want to model the inventory changing of a hospital based on their batch time and restock time. Here is a description on the logic:
1. I have the initial inventory at max, the inventory will be subtracted by 1 for each observation (each observation has a time of when the order is given).
2. When the inventory reach the min level, there will be a restock scheduled at the next batch time.
3. However, if the inventory dropped under critical low level within the current batch, the restock time will be scheduled at the current time plus 1 hour; and in this case, there will be no restock at the next batch time as it is already restocked.
4. At each restock time, the inventory will be reset to max.
5. At the same time, the time goes on and the inventory will be subtracted by 1 for each observation.

Please see the table below to help understand the logic.

 Record Inventory time batch next batch time restock time 1 max t1 1 bt2 / 2 previous record-1 t2 1 bt2 / 3 previous record-1 t3 1 bt2 / … … … 2… bt3…. / n1 min tn1 batch_n1 btn2 rtn1 (depend on if the following inventory within this batch will reach to critical low level) n2 previous record-1 tn2 batch_n1 btn2 rtn1 (depend on if the following inventory within this batch will reach to critical low level) … … … … … n5 critical low tn5 bacth_n1 btn2 tn5+1 (then at rtn1 there will not be a restock happened) n6 previous record-1 tn6 bacth_n1 btn2 tn5+1 …. max tn5+1 (restock time) n7 max ….

I tried the following code but does not work out as the inventory and restock time are dynamic changing and are dependent on each other.
data b; set a;
retain inventory;
by restocktime;
if first.restocktime then inventory=Max;
else inventory=inventory-1;
run;

So the problem I have is it is a dynamic process and the inventory and restock time is dependent on each other and both of them keep changing. Could anyone give any sussgetions on how could I model that? I'm totally lost.

Super User
Posts: 13,008

## Re: How to model a dynamic process with changing inventory?

Where is your critical level (threshold for reorder) value held? I would expect to have something with that value around to trigger the reorder.

I'm not even sure what role your "batch" means unless that is the name of an item (drug or other specific consumable)

New Contributor
Posts: 2

## Re: How to model a dynamic process with changing inventory?

The critical level is set as 20% of the min level.

Batch means the production batch for the drugs in the hospital. For example, the sample site hospital has 2 batches per day for restocking the drugs at 8am and 6pm.

Discussion stats
• 2 replies
• 157 views
• 0 likes
• 2 in conversation