I need to end up with only one file. When you say use a data step with an output for each unique file, do you mean output hours 1-12 into a data file then output 13-24 into a data file and combine them by date? Or am I interpretting this wrong.
That code works perfectly, however I would like to better understand it. I understand the concept of loops as I have a basic background in C++. I just don't see how the code takes hours 13-24 and moves them below 1-12. The code works, but can you explain it quickly so that I may understand better for next time?
The do loop works like a for loop would in other languages. By default SAS increments the value by 1 so you could have also writen it as:
do i=1 to 12 by 1;
So after each iteration the value of i increases by 1.
This loop happens for each row in the original data set. The first output statement writes the entire observation to the new dataset. The loop the shifts each hour value over 12 places. Then the second output statement writes the modified observation to the new dataset. If you dont include the drop statement you will see that the values of hour13-hour24 haven't actually changed.
To learn more about loops in SAS (or SAS in general) go to lexjansen.com which has many papers from SAS conferences.