Hello community, I have a table of data of different stores buys, these buys have a start date and an end date; so the amount bought in each operation, will last only between the start date and end date for every store, Below is an example of the data I have: data test;
input start_date :date9. end_date :date9. Store Amount ;
format start_date end_date date9.;
/*format Store $CHARw13.;*/
format Amount dollar8.1;
datalines;
01jan2019 09jan2019 LA 200
01jan2019 09jan2019 LB 1200
01jan2019 09jan2019 LC 500
01jan2019 09jan2019 LD 2500
01jan2019 09jan2019 LE 2300
01jan2019 09jan2019 LF 2100
01jan2019 09jan2019 LG 2900
01jan2019 09jan2019 LI 1900
01jan2019 09jan2019 LJ 3200
01jan2019 09jan2019 LK 4200
01jan2019 09jan2019 LY 5200
05jan2019 09jan2019 LO 2000
05jan2019 09jan2019 LB 120
05jan2019 09jan2019 LC 5000
05jan2019 09jan2019 LD 250
05jan2019 09jan2019 LR 230
05jan2019 09jan2019 LE 210
05jan2019 09jan2019 LP 290
05jan2019 09jan2019 LQ 190
05jan2019 09jan2019 LM 320
05jan2019 09jan2019 LA 420
05jan2019 09jan2019 LF 500
09jan2019 16jan2019 LO 200
09jan2019 16jan2019 LA 1200
09jan2019 16jan2019 LQ 500
09jan2019 16jan2019 LW 2500
09jan2019 16jan2019 LZ 2300
09jan2019 16jan2019 LD 2100
09jan2019 16jan2019 LR 2900
09jan2019 16jan2019 LT 1900
09jan2019 16jan2019 LG 3200
09jan2019 16jan2019 LL 4200
09jan2019 16jan2019 LB 5200
;
Run; From this data, I want to calculate the daily available amount for each store, So my data will need to look like the table below, and for each store I need to have the amount outstanding per date: the amount outstanding for each store, is the sum of all amounts in dataset test, that have a start date before the row date, and an end date after the row date; Date Store1 Store2 Store3 Store4 01-janv-19 , , , , 02-janv-19 , , , , 03-janv-19 , , , , 04-janv-19 , , , , 05-janv-19 , , , , 06-janv-19 , , , , 07-janv-19 , , , , 08-janv-19 , , , , 09-janv-19 , , , , 10-janv-19 , , , , 11-janv-19 , , , , 12-janv-19 , , , , 13-janv-19 , , , , 14-janv-19 , , , , 15-janv-19 , , , , 16-janv-19 , , , , 17-janv-19 , , , , 18-janv-19 , , , , 19-janv-19 , , , , 20-janv-19 , , , , 21-janv-19 , , , , 22-janv-19 , , , , 23-janv-19 , , , , 24-janv-19 , , , , 25-janv-19 , , , , 26-janv-19 , , , , 27-janv-19 , , , , 28-janv-19 , , , , 29-janv-19 , , , , Please excuse my question formatting, as I believe I have a problem formatting the store name; Thank you in advance.
... View more