Discover More Tips and Techniques on This Blog

SAS® Programming Guidelines

This paper presents a set of programming guidelines and conventions that can be considered in developing code to ensure that it is clear, efficient, transferable and maintainable. These are not hard and fast rules but they are generally accepted good programming practices. These techniques can be used in all types of SAS® programs, on all platforms, by beginners and experts alike.



SAS ® PROGRAM EFFICIENCY FOR BEGINNERS


Guidelines for Coding of SAS® Programs

David Franklin's SAS Tips

2009

November - Looping the loop with DO loops
October - The Use and Abuse of the NODUPKEY option in the SORT Procedure
September - Comparing all datasets in one directory against all the datasets in a second dataset, using CALL EXECUTE
August - Selecting data for a particular month
July - I am missing a '0' in front of my day value, can SAS still read it okay? (or can SAS read a text date of '6JUN2009' correctly)
June - Prefixing a value with '+' or '-'
May - Why use dataset variable labels?
April - More on using a FORMAT to merge data
March - Delete all datasets in a library, except ...
February - Getting rid of the message "NOTE: BASE data set does not exist. DATA file is being copied to BASE file."
January - SUM(OF variables)


2008


December - Making a copy of a SAS dataset, Part 2
November - How would I set only character or numeric variables of an observation to missing?
October - Making a copy of a SAS dataset, Part 1
September - Character to Numeric Conversion
August - Numeric to Character Conversion
July - How would I set all variables of an observation to missing?
June - Making a SAS Transport File
May - Creating a Batch File
April - Transposing the data and label
March - Get a listing of all the SAS programs for a particular directory
February - Enclosing a negative value within brackets
January - Stripping (text)

2007

December - The CALL MISSING Routine
November - The MISSING function
October - Renaming a SAS dataset variable
September - Since when does a null string have a length of 1?
August - I just received a dataset with the dates in dd/mm/yy format but I want them in mm/dd/yy format for my report
July - The COLLATE function
June - PROC MEANS vs PROC SUMMARY
May - What SAS modules are on your system, and how to work around those that are missing
April - Removing labels and formats from all variables inside a dataset
March - Deleting old datasets using a date
February - The trig functions
January - FLOOR, CEIL, ROUND and INT

2006

December - Creating a graph using ODS RTF
November - Using the DHMS function to create a datetime value
October - Using CARDS or DATALINES to input data
September - FORMCHAR
August - Does the string contain a number?
July - LOWCASE/UPCASE/PROPCASE
June - Why use DATA _NULL_
May - Does x+y = SUM(x,y), revisited
April - Six ways to make your program run faster
March - SQL and the CALCULATED keyword
February - TRIM and TRIMN
January - Four Common Ways to Merge Two Datasets

2005

December - The CANCEL option in the RUN command
November - The DIM function for repeating the same action of different variables
October - The COMPARE function
September - Getting the last word in a string using SAS or Excel
August - Using SASHELP.VMACRO to view your macro variables, and %SYMDEL to delete them
July - Deleting a SAS dataset, revisited
June - Using PROC CHART to do a quick frequency analysis
May - The Variance results from SAS and Excel are different!
April - Finding a duplicate key record, Part II
March - The 2005 Conference Season begins
February - Sometimes, overwriting a dataset does not replace it
January - How does SAS store your date and/or time?

2004

December - Does x+y = SUM(x,y)?
November - An example of some unexpected results
October - Does a macro variable exist in your program?
September - Adding a value to an existing format
August - Common Mathematical Operators
July - Getting the background color from an Excel Worksheet cell
June - BYTE/RANK (this is not eating a hamburger)
May - The 2004 Conference Season begins
April - Getting a Cell Comment inside an Excel Worksheet
March - Finding a duplicate key record
February - FIRSTOBS=, OBS=
January - A BAT to create a Backup of your file

2003

December - SAS and Excel do not compute the same quartile value
November - Using a format to group basic statistical analysis
October - Coding a missing value
September - Sometimes your System Command Call within SAS does not work
August - COMPRESS or COMPBL, that is the question
July - Placing Unique values from a dataset into a macro variable
June - Share your datasets with others, consider the SASViewer
May - INDEX, INDEXW and INDEXC
April - Deleting a SAS dataset
March - Helping a SORT run faster
February - To avoid confusion, define the variables you create in a datastep
January - Introduction/Have a notebook handy

How to do a many-to-many merge in SAS without using SQL;

A many-to-many match-merge is more complicated. When we try to do many-to-many merge that means both the data sets have multiple occurrences of BY variable values. Simple match-merge the two data sets using the BY statement is never OK… Because when we do, we get the following note in the log.
"NOTE: MERGE statement has more than one data set with repeats of BY values."


SAS Programmer always tries to avoid this message in the log file….because this message means that the resulting data set is probably not what we expected.

Don’t be afraid that there is no way… you can do many-to-many merge using data step. A well known SAS Expert David Franklin points out a way to do many-to-many merge





Many Thanks David!

(Read his original post here)


NS8PO19P

The Fundamentals of MERGE

You can get the SAS Code back even If you haven’t saved it

If you happen to be one of the unlucky programmers who lost the SAS code … because you didn’t save it. There is solution for that…. SAS System automatically takes the backup of the SAS code for every 10 minutes (default);

Just look in the following location:

C:\Documents and Settings\Programmer Name\Application Data\SAS\EnhancedEditor\

Note: Replace “Programmer Name” with your login user id of the System you are using;
If you go the specified location above, you will see a copy of the unsaved version of the SAS code.
It will be quick if you search files with the extension name ‘.$AS’ (extension for auto-saved SAS codes)


If you want, you can also change the 10-minute time interval for Auto save…. Go to…


Tools Options Preferences Edit.


In the preferences dialog box, make sure to the change the time under Autosave every …. And click on OK ...

tod8. and picture formats: How Can I Find a Time Format that Does Not Remove the Leading Zero e.g. Time5

How Can I Find a Time Format that Does Not Remove the Leading Zero e.g. Time5
(output printed as 09:36 instead of 9:36)?
I have found an intersting solution to this problem in http://www.sas.com/; direct link

(Suggested by Stephen Hoar, Lloyds TSB)

There is currently no time format that puts leading zeros automatically in time values. But there are a number of ways of achieving this, below are some examples.

Example 1:
Create your own custom format using the following syntax. Then format your data values using the user defined format.


proc format ;
picture military other = '%0H:%0M:%0S' (datatype=time) ;
run ;

data test;
x= '9:36't ;
format x military8. ;
put x=;
run ;

x=09:36:00


Example 2:

You can also use the TODw.d format which does write leading zeros, but the original value must be a SAS datetime value. To convert your time values to datetime values use the DHMS function. In the DHMS function insert the value: 0 date, 0 hours, 0 minutes, and then the SAS time value as the number of seconds.

Then format the new variable with the TODw.d format and you will have the correct time, including the leading zeros.


data test;
x='9:36't;
y=dhms(0,0,0,x);
format y tod8.;
put y=;
run;

y=09:36:00

Have a look at the following Technical Support website for further examples of using Date & Time functions and formats: http://support.sas.com/techsup/sample/functions.html

SAS Arrays and DO-LOOPS

SAS Do Array

Three SAS Programs that use Arrays

SAS Macros that Convert a Directory of Transport Files

There is a set of SAS macros, converts a directory of transport files to a directory of SAS data sets and format catalogs (and vice versa). To see how to invoke the macros, look at the test following the last macro. The macros make the assumption that transport files created from data sets have the extension .xpt, and transport files created from format catalogs have the extension .xpf.
%expfmts : This macro will convert an existing format catalog into a data set in transport format.
%expdset: This macro will convert an existing SAS data set into a transport file.
%impfmts: This macro will convert a transport CNTLOUT data set into a native format catalog.
%impdset: This macro will convert a transport data set into a native SAS data set.
%getnames: This macro will create a SAS data set consisting of a variable called FILENAME. There will be one observation for each file in the specified directory with the specified extension.

SAS Display Manager Commands

In my view, Display Manager commands didn’t get much attention of SAS programmers as they should be. It may be because...

1) SAS Documentation has very little information about how to use this facility.
2) Even Google searches aren’t helpful enough.


Here is the list of Display Manager Commands I know…

dm"log; clear; out; clear;";*Clears Output and Log Window;
dm "vt work.dsn" ; *Opens the dataset DSN in a View table window;
dm "vt &syslast"; *Opens the dataset recently created;
dm 'next viewtable:work.dsn; end;';*Closes the VT window of DSN;
dm 'keydef f12 submit';*Assigns the submit command to the F12 key ;
*Assigns clear log and output commands to F2 Key;
dm "keydef F2 'cle log; cle output; submit'";
*applies detail view to explorer window;
dm  "next explorer; detail";

dm "next log; detail"; *Opens the Log Window;
dm "next output; detail"; *Opens the output Window;
dm "next editor; detail"; *Opens the Editor window;
dm 'next VIEWTABLE:; end;'; *Closes all opened viewtable windows;

dm 'odsresults' clear ; * Clears the Results window;
dm 'log off'*Closes the LOG window;

dm "VT libname.dataset COLHEADING=NAMES";


VT=View Table.
COLHEADING=NAMES option displays column names as column headings instead of column labels which is default.


read more about DEXPORT and DIMPORT DM commands:
http://studysas.blogspot.com/2009/06/dexport-and-dimport-display-manager.html

dm: Display Manager
vt: View Table
keydef: Key Definition

Proc SQL for SAS Programmers

Yesterday I came across a website BLINK7. It is a great site to browse and to get help to improve your SAS knowledge in Proc SQL and Base SAS. This website offers a lot of information in the form of sample codes and tutorials on different topics in SAS.

SQL for SAS Programmers - Introduction

What is SQL?

SQL stands for Structured Query Language and was designed for development and maintenance within a Database Management System (DBMS). A DBMS consists of one or more tables of data, typically joined in a hierarchical fashion, and a series of programs for organizing the data.
Typical tasks performed with SQL code include the following:

  • Retrieve (or query) data from one or more data tables
  • Manipulate data within existing tables
  • Define new tables and create data within new table
  • Alter existing table definitions
  • Set permissions for different users to access existing tables

The first part of this tutorial deals with using the PROC SQL statement to perform basic data extraction. Screenshots of the code and output are included. Readers who wish to follow along on their own systems or copy the code can download the files provided below (right click and select “save as” or “save link as”):

read more at:....

(download) SAS Code for Tutorial Part 1
(download) SAS Data: Transactions
(download) SAS Data: Payment Types
(download) SAS Data: Staff

SAS Tutorial: Creating Categories with PROC FORMAT

SAS Tutorial: Loading Tab-Delimited Files

source: www.blink7.com




Comparing SAS steps and PROC SQL_ Coding and Performance -


Basics of SAS PROC SQL -

Using ODS to Create Customised Output

Using the SAS Output Delivery System (ODS), you can create, customise, and manage HTML output in any operating environment by submitting programming statements. After creating HTML files, you can view them using Internet Explorer, Netscape Navigator, or any Web browser that fully supports HTML 3.2.

ODS gives you new formatting options and makes procedure output much more flexible. With ODS, you can easily create HTML, RTF, PCL, PS, XML, Latex and PDF output, an output data set of procedure results and traditional SAS listing output. Also, ODS stores your output in its component parts (data and table definition) so that numerical data retains its full precision.

Procedure output is divided into components, or output objects. Depending on the procedure that you run you might have one or several output objects created. For example proc print would create just one output object but proc univariate would produce multiple output objects. ODS stores a link to each output object in the results window. Using ODS programming statements we can control what output objects we are interested in and what ODS destinations we want to send them to.

In order to start creating HTML, RTF, PDF files etc. you will need a few ODS statements to get you started. By default SAS output still goes to the output window. In order to send the output elsewhere you need to open the appropriate destination. The example below turns off the listing destination (the output window) and opens the HTML destination so that it is ready to receive our output. When the HTML destination is closed the class.html file is created and the HTML destination is closed:


Ods listing close;
Ods html body='c:\myreports\class.html';
Proc print data=sashelp.class;
run;
Ods html close;
Ods listing;

Read more.....

SAS Tip_less code: Assigning 1 or 0 to flag variable

*Creating a flag variable when a test variable meets certain criteria is very common for SAS programmer….

Many SAS programmers use the below code to assign a flag of 1 or 0 depending on of the test variable meets criteria or not.;

*Ex:;

*Create a test dataset;
data test;
input id age sex $;
cards;
1 25 Male
2 35 Female
3 29 Female
4 37 Male
5 32 Male

;
run;


*Most programmers use the following code to assign avalue of 1 0r 0 to flag variable;

data test1;
set test;
if sex='Male' then flag=1;
else flag=0;
run;


*Some programmers use the following code to do the same task;
data test;
set test;
flag=ifn(sex='Male',1,0);
run;

*You can write ....even simpler code than the above 2 dataset step methods.;

data test2;
set test;
flag='Male'=sex;
run;

*Or;

data test3;
set test;
flag=sex='Male';
run;

*Note: The above code does the same thing as the 1st and 2nd method;
Caveat: This code works only when you are trying to assign a value of 1 and 0 to test variable;


Dummy Dataset or SAS Options: Which is better to insert a Zero Row?

Always, programmers need to summarize the demographics data and show it in a table and to do so they use Proc Freq procedure. Even though proc Freq calculates the Frequency exactly, it may not be the write procedure in all cases especially when data do not exist.

Some times statistician wants to see all the data values on the CRF in the final table, even though there is no combination as such exists in the dataset. In this case we have to insert observations with 0 values.

Here I will present you ….the different methods to insert a zero row.

1) Creating a Dummy Dataset and Concatenate the dummy dataset with the input dataset.
2) Proc Freq SPARSE option
3) Proc Means COMPLETETYPES Option
4) Proc Means COMPLETETYPES Option with PRELOADFMT option.
Dummy Dataset:
Adv: Simple and doesn’t need any formats
Caveat: Programmer has to know all the possible combinations

Sparse Option:
Lists all possible combinations of variable levels even when a combination does not occur.

Syntax:

proc freq data=demo noprint;
table sitec*race /sparse out=freq (drop=percent);
run;

Using SPARSE option in Proc Freq, SAS outputs one record for each possible combination of variables mentioned in tables’ statement.


Adv: Convenient and Simpler.
Dis.Adv: Sometimes CRF has more types than we normally see in dataset. If Statistician want us to keep one record for each type mentioned in the CRF, SPARSE option in the proc freq doesn’t work as expected. Because SAS doesn’t know what other possible combination occurs in the dataset.

Caveat: There must be at least one occurrence of a value for SPARSE to summarize appropriately.

Proc Means using Complete Types Option:
Syntax:

proc means data=demo completetypes noprint nway;
class sitec race;
output out =race(rename=(_freq_=count) drop=_type_);
run;

Adv: Simple and easy to write…..Proc Means with COMPLETETYPES option works similar to Proc Freq SPARSE option.

Caveat: There must be at least one occurrence of a value for COMPLETETYPES option to summarize appropriately.

Proc Means using COMPLETETYPES and the PRELOADFMT option:
PRELOADFMT Option tells SAS to load all the formats (mentioned in the Proc Format procedure for particular variable) in memory before start executing the Proc Means CLASS statement.

One important thing here you should know is about how to use this option.
If you want to use this PRELOADFMT option in the CLASS statemnt, you should also use either of COMPLETETYPES, EXCLUSIVE or ORDER=DATA options.

When you use the PRELOADFMT option in combination with the COMPLETETYPES option, SAS create the output with all the possible combinations even if the combination doesn't seen in the input dataset.


Syntax:

proc format;
VALUE $RACEF
'Asian'=3
'Black'=2
'White'=1
'American Indian or Alaska Native'=4
'Native Hawaiian or Other Pacific Islander'=5;
run;

data demo;
set demo;
format race $racef.;
run;

proc means data=demo completetypes noprint nway;
class sitec race/preloadfmt;
output out =race(rename=(_freq_=count) drop=_type_);
run;
Adv: Simplicity of use
There is no requirement to have at least one occurrence of a value in the data.

Caveat: This method only works if we use formats in combination with our data. You don’t necessarily need to know what the format values are, but we have to make sure formats are assigned to all variables we are trying to summarize.

YOu can use PRELOADFMT option in Proc means , Proc summary and Proc Tabulate.


Example:

data demo ;
input siteid $ sex $ race $ age ;
cards;SITE1 M White 23
SITE1 F White 43
SITE1 M White 34
SITE2 M Black 21
SITE2 M White 56
SITE2 F Black 33
;

run;

proc sort data=demo;
by siteid;

run;


*Without any options in proc freq;
proc freq data=demo noprint;
table siteid*race /out=nooptions (drop=percent);
run;














*With Sparse option in proc freq;

proc freq data=demo noprint;
table siteid*race /sparse out=_sparse (drop=percent);
run;








*With Completetypes option in proc means;
proc means data=demo completetypes noprint nway;
class siteid race;
output out =comptyp(where=(_stat_='N')rename=(_freq_=count) keep=siteid race _freq_ _stat_);
run;
















*With Completetypes and preloadfmt options in proc means;
proc format;
VALUE $RACEF
'Asian'='Asian'
'Black'='Black'
'White'='White';

run;


data demo;
set demo;
format race $racef.;
run;

proc means data=demo completetypes noprint nway;
class siteid race/preloadfmt;
output out =race(where=(_stat_='N')rename=(_freq_=count) keep=siteid race _freq_ _stat_);
run;

Output:














With PRELOADFMT in the CLASS statement and COMPLETETYPES option in the PROC MEANS statement, SAS will include all the possible combinations of classification variables in the output as well as zero rows (0 observations).

Case Report Tabulations for The FDA Submission

The Case Report Tabulation (CRT) is the collection of the annotated case report form (CRF), SAS® datasets, metadata, and source programs that comprise a portion of the NDA package submitted to the FDA. The FDA uses it when reviewing submissions. Review starts with the Define document which contains metadata describing the datasets, variables, and values. It is all tied together using internal and external hyperlinks, bookmarks, and destinations to make it easily navigable1.

The CRT is essentially a collection of data and documentation for a study. It contains features such as bookmarks and links to allow reviewers to easily navigate the submission. For consistency, there are guidelines from FDA1 and CDISC defining the components though the guidelines are limited in scope.

We need to create Define Document (define.pdf or define.xml) as a part of CRT.
  • Each dataset is a single SAS transport file and, in general, includes a combination of raw and derived data.

  • Each CRF domain (e.g., demographics, vital signs, adverse events) should be provided as a single dataset.

  • In addition, datasets suitable for reproducing and confirming analyses may also be needed.

  • Patient profiles can also be provided as PDF files


    In 2003, FDA …. Interpreted….. 21 CFR 314.50(f) (1) as defining CRTs to include2:


  • Study Data Tabulations
    Statistical Analysis Datasets
    Data Listings
    Patient Profiles

    Draft eCTD Guidance: Case Report Tabulations

    Data tabulations ___Data tabulations datasets ___Data definitions

  • Data listings ___Data listing datasets ___Data definitions

  • Analysis datasets __Analysis datasets ___Analysis programs ___Data definitions

  • Subject profiles

  • IND safety reports

Data Tabulations:

  • Data tabulations are datasets in which each record is a single observation for a subject.”

  • Specifications are located in the Study Data Tabulation Model (SDTM) developed by CDISC at www.cdisc.org/models/sds/v3.1/index.html. *Each dataset is provided as a SAS Transport (XPORT) file.
Data Listings:

  • “Data listings are datasets in which each record is a series of observations collected for each subject during a study or for each subject for each visit during the study organized by domain.”


  • Currently, there are no further specifications for organizing data listing datasets.


  • General information about creating datasets can be found in the SDTM implementation guides referenced in the data tabulation dataset specifications.


  • Each dataset is provided as a SAS Transport (XPORT) file.
Analysis datasets:

  • “Analysis datasets are datasets created to support specific analyses. Programs are scripts used with selected software to produce reported analyses based on these datasets.”


  • Each dataset is provided as a SAS Transport (XPORT) file.


  • Programs should be provided as both ASCII text and PDF files and should include sufficient documentation to allow a reviewer to understand the submitted programs.


  • It is not necessary to provide analysis datasets and programs that will enable the reviewer to directly reproduce reported results using agency hardware and software. Currently, there are no other additional specifications for creating analysis datasets.
Subject Profiles:
  • “Subject profiles are displays of study data of various modalities collected for an individual subject and organized by time.”

  • Each individual patient’s complete patient profile is in a single PDF file or a book-marked section of a single PDF file for all patients.


References: http://www.lexjansen.com/pharmasug/2009/rs/rs08.pdf
http://www.amstat.org/meetings/fdaworkshop/presentations/2005/P07_Christiansen_CDISC.ppt http://www.cdisc.org/stuff/contentmgr/files/0/f56015f6c1c01e6aa55767d9d25bddb5/misc/officeofbusinessprocesssupport.pdf

DLP (Data LifeCycle Plan)


The DLP (Data LifeCycle Plan) guides an organization and serves as a blueprint for how to create every type of data across all therapeutic areas and functional specialties. Howard describes the DLP as "an overall document that says here are the things you need to think about." In some DLPs, there might be more than 15 chapters, each controlled by a group of domain experts.


Standard operating procedures (SOPs) typically cover process. DLPs, in contrast, are technical specifications about what happens to the data. Both SOPs and DLPs should be subject to similar governance. The DLP creates a framework for discussions that do occur on their own, but it forces them to an earlier stage of the process.



Here's a sample chapter of a DLP for demographic data from Kestrel Consultants, Inc.

The Future of ODM, SDTM and CDISC


Setting The Record Straight: The Future of ODM, SDTM and CDISC
November 05, 2008
By Rebecca Kush, Frank Newby, David Iberson-Hurst, & Amanda J de Montjoie, CDISC


When rumors increase, and when there is an abundance of noise and clamor, believe the second report. Alexander Pope, 1688–1744


In recent weeks, there have been a number of rumors about the Clinical Data Interchange Standards Consortium CDISC standards and their continued use by the Food and Drug Administration (FDA). These whispers suggest that the Study Data Tabulation Model (SDTM) standard is being replaced and that the Operational Data Model (ODM) should no longer be used. The rumors have caused confusion at best and fear of standards abandonment at worst. This is a second report—an attempt to clarify what’s happened and how the industry should move forward.


CDISC, to state the obvious, is a global standards organization. While the FDA plays a vital role in the drug development industry in the U.S., there are other global stakeholders that use CDISC standards. CDISC’s influence extends as far east as Japan, Australia and China—and is well established in Europe.


An International Agenda

Just as biopharmaceutical communities are expanding globally, CDISC is being asked to meet with regulatory authorities in China and with academic representatives in Singapore, India and Brazil. CDISC has Liaison A status with the International Standards Organization Technical Committee 215 and works closely on global standards harmonization with CEN, ISO and HL7 as a member of the Joint Initiative Council.


Define.XML

Define.xml which generally describes what are we submitting to FDA .. like case Report Tabulations ( SAS datasets in XPT format, annotated CRF’s and the variables (metadata)) in a machine readable format….. In simple words it is .....Data and Metadata in Machine-Readable Format. It is considered as the standard process for submitting metadata to FDA and other regulatory bodies….



























MedDRA and WHODrug Coding

Though there are other Coding dictionaries available along with MedDRA (ex: COSTART and WHOART), MedDRA dictionary is typically used in the US for Adverse Events coding.

AE\MedDRA coding is not the SAS programmers work; it is usually done by medical coder or database programmer. Coding basically involves a process of finding a dictionary term that matches the verbatim term reported on the CRF, and getting the other related dictionary derived variables useful for the analysis like System Organ Class (SOC), Preferred Term (PT) and Lowest Level Term (LLT), etc.

Some times this process may take more time than expected, because Misspellings and other differences would delay the process of coding. In that case, person responsible for coding has to look for the dictionary term that which is the best possible match from the MedDRA dictionary.

So the question here comes is what SAS programmer can do in this process.

Here is the Answer….

SAS programmer has to work hard to make this process successful. In other words he is also a key player in this game.

SAS Programmer provides a list of reported AE terms on the CRF to the medical coder in a flat file/excel file, who then search for a best possible match and related terms for AE term of CRF in the MedDRA dictionary. He then enters them in the supplied flat/excel file and returns back to the SAS programmer.

The next SAS programmer duty is to assign the Dictionary derived Term, SOC, LLT and PT to the AE Terms in the AE dataset by merging. (Use Proc SQL or Simple Merge)

MedDRA dictionary gets updated twice a year, so it is important to be aware of the version used for the coding.

If the data is clean (Assuming that there are no misspelling of AE terms or other problems then MedDRA coding is easy…. What you have to do is locate the MedDRA SAS dataset and then merge the MedDRA dataset with the AE dataset using the preferred term.
















Making Code Review Painless

ABSTRACT:
Code review is an essential step in the development of concise and accurate SAS® programs. It is a required verification step in performing validation in a regulated environment. This paper will present techniques and a macro that can be freely downloaded to automate this task. The %coderev macro will perform many of the common tasks during a code review including:

1. Spell checking headers and comments
2. Reviewing all input and output datasets of the program
3. Comparing defined macro variables versus macro variable usage
4. Checking for multiple macro calls that are not in a macro library
5. Evaluating hard code logic
6. Evaluating sort order of all datasets

These tasks are normally performed by an independent reviewer instead of the original programmer. By automating the tasks, the code review process will ensure that the smallest mistake can be captured through reports to ensure the highest quality and integrity. What normally is a dreaded task can now be done with ease.
Thanks to Sy Truong, Meta-Xceed, Inc, Fremont, CA

SAS Instructor Tips: Programming

SAS Instructor Tip: Programming

Featured Instructor: Cynthia Johnson

How do I combine my SAS data sets and eliminate duplicate rows at the same time?

SAS Instructor Cynthia Johnson responds ...




SAS Instructor Tip: Programming

Featured Instructor: Kent Reeve

What happens when you forget the period on an informat when using formatted input?




SAS Programming Tips[1]



SAS/GRAPH Tip: Controlling the Graph Axis

SAS Instructor Cynthia Zender shows you how to control the graph axis through a feature of using the AXIS statement.



SAS ODS Tip: Creating Page X of Y Page Numbers
SAS Instructor Cynthia Zender shows you how to use the SAS ODS ESCAPECHAR to create a "Page X of Y Page Numbers"



SAS ODS Tip: Creating a Table of Contents

SAS Instructor Cynthia Zender shows you how to create a table of contents using the CONTENTS= Option with ODS RTF and ODS PDF destinations.



SAS ODS Tip: Controlling the Width of Cells

SAS Instructor Cynthia Zender shows you how to control the width and spacing of cells using STYLE=Overrides that have been designed for the ODS destinations that support STYLE.



SAS Programming Tip: Subsetting Data with a WHERE Statement

SAS Instructor David Ghan shows you how to to use a WHERE statement to subset your data.




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.