Ron Cody's 6 helpful tasks for SAS users

0

Ron Cody’s at it again. It’s like he just can’t help himself; he knows SAS and wants to help others know it too. His new book, Cody's Collection of Popular SAS Programming Tasks and How to Tackle Them gathers often-used programming tasks and techniques in one handy volume, allowing users to quickly and easily accomplish what they need to do with SAS.

We asked Ron to share some of those tasks that he thought users would find especially helpful. Here’s what he said:

  • Were you ever given a SAS data set with variables such as Height, Weight, or Age and they were all character values?  If so, join the club.  One of the tasks I include shows you an easy way to convert selected character variables into numeric variables.  Better still, I include a macro that allows you to specify an input and output data set name, along with a list of character variables that need converting, and the macro automatically creates a new data set with all the character variables converted to numeric, maintaining the original variable names.
  • Do you ever need to check for possible errors in your numeric values?  If so, you will find two macros in this book that will help you.  One of them allows you to specify ranges for each numeric variable and generate an error report for any observations where a value is outside the specified range.  The other macro uses automatic outlier detection to report possible data errors. 
  • Have you even needed to concatenate two SAS data sets?  Of course you have!  This is easily accomplished using a SET statement of PROC APPEND.  What if the two data sets have character variables whose lengths are not the same in the two data sets?  This problem is solved by a macro that concatenates the two data sets, using the longer length of any character variables that are not the same in the two data sets.
  • It is sometimes convenient to perform an operation on every numeric or every character variable in a SAS data set.  For example, you may want to convert all numeric values of 999 to a SAS missing value or to convert all character values to uppercase.  These tasks are demonstrated in my new collection.
  • How about combining summary data (perhaps a mean of all observations) with detail data?  One of the chapters shows you several interesting ways to accomplish such tasks.
  • Restructuring (also called transposing) a data set from one observation to many or vice versa is a common programming requirement. You will find programs to perform these tasks using a DATA step approach and using PROC TRANSPOSE.

Find all of this and more in Cody's Collection of Popular SAS Programming Tasks and How to Tackle Them See if this book is right for you by previewing a sample chapter.

Share

About Author


Comments are closed.

Back to Top