Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Image Modified

Introduction

Section content first added by: Nicky Fahers 2010-11-19

How do you know if you and your colleagues are actually following good programming practice?

The main aim of code reviews are to make sure that all SAS programs are following Good Programming Practice.

...

Implementation of a Code Review Process
All companies will tackle code review in different ways and some will not perform any at all. Here are a few examples of how code review has been performed in other companies:


Scenario 1

Everyone in the department who writes SAS programs will have their code reviewed by the lead programmer of the study. The code reviewer will review the code and give informal feedback to the Lead programmers code will be reviewed by the code review team.

  • Note all comments are confidential and will NOT be fed back to anyone else.

Ideally it would be code you have written from scratch If not:

Code you have changed substantially.

or

A section of code that you have added or adapted. Highlighting clearly what you have added or changed.

Common findings are presented in department meeting and training is given accordingly


Scenario 2
Code reviews are only performed on people with less than 6 months experience


Common Findings 


General EfficiencesEfficienciesAdvice 
  • No Program Header
  • Header with incorrect details or not enough detail
  • No comments throughout the program
  • Over writing datasets over and over again
  • Lots of unnecessary proc sorts
  • Lots of unnecessary data steps
  • Incorrect merging of datasets (learning how to use proc sql)
  • Use arrays and proc transpose- know when to use them
  • Use SAS functions
  • Use standard macros
  • Create a macro for repeating code
  • Simple is best- do not over complicate things

Plan and structure your program before you start

...