I have a 'live' sales data table which updates in real time with sales values. Every 5 minutes I want to get the sum of all sales made and then append to a secondary table which is storing all historical records. Rather than someone clicking run every 5 mins I want to automate the process - which I think I've achieved in the code below. However, I also need to be able to see how the sales figures in the 'master' data table are increasing and this is what I don't know how to do while the macro loop is still running. Ideally I would like the 'master' data in a spreadsheet so I can have a graph/chart updating as the data updates. %macro sales ; %let count=0 ; %do %until (&count=2) ; %let count=%eval(&count+1); /* Latest snapshot */ data interim ; set livesales; format runtime time. ; runtime = time() ; run ; /* Append to previous records */ data master ; set master interim ; run ; /* Delay next run for 5 minutes */ data _null_ ; rc=sleep(300,1) ; run ; %end ; %mend ; %sales ;
... View more