Discover More Tips and Techniques on This Blog

Better programming practice tips.

                                                  Better programming practice tips.
1. Header Description: It is very important to have a descriptive header inside a SAS program.

********************************************************************;
Program Name       : name.sas
Author             : Sarath Annapareddy
Date last Modified : Apr 02 2010 :
Purpose/Description: Macro to add titles and footnotes
Input Files        :
Output Files       :
Macros Used        :
Notes              :
*********************************************************************;

2. Use proper indentation: New step (e.g. data step, proc sort, proc sql, etc) must always start with no indentation, first line in any step must have one tab indentation line and after if (or similar) statements we must have one additional tab indentation before the next if (or similar) statements.

3. UPCASE: Always use uppercase variable name and uppercase dataset names (including temporary datasets created in the program)

4. Dataset Names: Never use same dataset name for input and output datasets.

5. Comments: Comments are used to make your program easier to read and edit. Use the comment statement anywhere in a SAS program to document the purpose of the program. Nothing is more frustrating as to return to a program written months ago and not being able to figure out what you did and why you did it. Also, if someone else needs to look over your program, the task is made much easier, if the code is commented.

6. Create a Macro: If you think code will be used in multiple programs, create a macro. Do not try to do multiple things in one macro; chances are if something is broken in the macro, other programmer will not use that macro in their program.

7. Give some meaningful name to the temporary datasets.





Disclosure:

In the spirit of transparency and innovation, I want to share that some of the content on this blog is generated with the assistance of ChatGPT, an AI language model developed by OpenAI. While I use this tool to help brainstorm ideas and draft content, every post is carefully reviewed, edited, and personalized by me to ensure it aligns with my voice, values, and the needs of my readers. My goal is to provide you with accurate, valuable, and engaging content, and I believe that using AI as a creative aid helps achieve that. If you have any questions or feedback about this approach, feel free to reach out. Your trust and satisfaction are my top priorities.