Hi! Some years ago I read a very good book about efficient coding. In summary: Solve the correct problem, make sure that your code is as clear and easy to understand as possible. If you have time spend it on documenting the problem and the solution. - When all this has been done - then you can start to experiment with writing the code, so that it runs faster.
(The book was written in 1966 I think. Efficient Fortran techniques. CPU and IO were VERY expensive at that time).
I/O can be expensive still, in run-time
For that reason, I often create data step views rather than intermediate tables. (but only when the view would be read just once or twice)
The advantage views provide is a major reduction in I/O.
The intermediate data is being created as it is read.
To achieve this, often sort+merge processes are replaced with format/array/hash look-ups.
Hi Peter! I DO agree about Data Step view. I have used them several times, which resulted in great reductions in computer resources needed.
Views can be very helpful. I've made the experience though that when "nesting" too many SAS SQL views it can have a negative impact on performance. "The theory" is that this is due to the SQL optimizer no more properly optimizing the SQL.
It's probably inevitable that the optimizers have a limit to the resources they can use to "layer" the views. Each time I have had to trial with high volume data to ensure production processes will be resilient.
As usual, there are trade-offs between I/O and cpu time.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.