Over a period of ten years, I have seen much good code, much more bad code, and lots more of mediocre and lazy coding habits. From my experience here are some ten tips to improve your SAS coding experience.
1 ) Use options compress=yes; Â to save space. This saves space by a factor of 50%. I have often been bemused by the number of times I have been approached for more data storage by analytics practitioners and their wonderful exclamations of surprise on hearing about this option.
2 ) Do not rely on the SAS Macro language excessively. Code should be easy to read and modify. Use options macrogen symbolgen; to make Macro code in logs more readable. Using the SAS Macro language excessively is a traditional swagger fail in power and advanced users.
3 ) Preferably copy and paste small parts of log in the script code itself , if you are not in the habit of saving logs. Comment out the logs/output. This is needed especially for version control of datasets, variable creation, file sizes. While copying and pasting logs and output to script/editor window can sometimes be problematic , it helps make code more understandable and much more efficient to project managers and transition managers. Version control in dataset names is critical to make the projects more streamlined.
4 ) Please comment on code. Not every human being can read SAS code like a computer. Use Ctrl + / to comment and Ctrl + Shift + / to uncomment code. Comments are statments and code between /* and */ Â and they are ignored upon program execution.
5 ) Use Keyboard Macros to cut down on repeated code steps like various procs.
6 ) Utilize Cross Tabs– Use –
proc freq  data=dataset ;
tables varnames*varnames2 Â /list nomissing ;
run ; as a powerful way to understand cross tab as an analytical technique. It beats many other more complicated ways to look at the data.
7 ) It is best to optimize and balance Proc sql and Data step for data manipulation. While Proc SQL is quite good for existing learners of SQL and for merging datasets if they are indexed, the Data Step is a powerful way to manipulate data. Avoid using either of them exclusively to the detriment of the other.
8 ) Read updates to support.sas.com or participate on sascommunity.org as many new features are often buried deep within these websites. New methods like hash method are quite powerful.
9 ) Learn cross platform techniques like using R from within SAS, or connecting to Oracle Databases from SAS, or using SAS and JMP together. Preferably get  certified in at least one analytics certificate.
10 ) Learn how to use sub queries within proc sql efficiently including using aggregated functions within proc sql. The case expression method is a powerful and much underutilized method within proc sql.
Hope this helps your SAS coding. Do share your top practices.
Fill in the details to know more
Strategic Sales: Channelize Your Inner Storyteller To Own A Glorious Sales Career
March 22, 2023
Artificial Intelligence – Learning To Manage The Mind Created By The Human Mind!
Average Sales Manager Salary in India
March 8, 2023
Artificial Intelligence Salaries for Freshers!
March 1, 2023
Top Artificial Intelligence Companies to Look Out for in 2022-23
October 22, 2022
7 Ways To Develop A Portfolio That Gets You Hired
September 29, 2022
Add your details:
By proceeding, you agree to our privacy policy and also agree to receive information from UNext through WhatsApp & other means of communication.
Upgrade your inbox with our curated newletters once every month. We appreciate your support and will make sure to keep your subscription worthwhile