BookmarkSubscribeRSS Feed
dengyg
Calcite | Level 5
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. 
 
 
RecordInventory timebatch next batch timerestock time
1maxt11bt2/
2previous record-1t21bt2/
3previous record-1t31bt2/
2…bt3…./
n1mintn1batch_n1btn2rtn1 (depend on if the following inventory within this batch will reach to critical low level) 
n2previous record-1tn2batch_n1btn2rtn1 (depend on if the following inventory within this batch will reach to critical low level) 
 
n5critical low tn5bacth_n1btn2tn5+1 (then at rtn1 there will not be a restock happened)
n6previous record-1tn6bacth_n1btn2tn5+1
….     
 maxtn5+1 (restock time)   
n7max….   
 
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.
 
 
 

 

2 REPLIES 2
ballardw
Super User

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)

dengyg
Calcite | Level 5

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

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