User Defined Formats In SAS (PROC FORMAT Guide)

The formats in SAS are a very underrated feature among the SAS programmers. Especially when it comes to user defined formats. It has been seen that people happily use join or complex look-up logic but don’t want to create user defined formats. This is probably because not everyone is aware of the real power of … Read more

How to Create [Permanent] User Defined Formats in SAS

You have already learned how to create user defined formats in SAS using the proc format procedure. This article is an extended version of that comprehensive guide. In this article you’ll learn how to create user defined formats using the proc format procedure in the permanent SAS library. SAS formats created in the WORK library … Read more

How to Rename SAS Datasets (In #3 Simple Ways)

Changing the dataset names or creating backup of existing data sets are kind of basic tasks you do as a developer. It’s often used when you do investigation on finding data errors or making changes in the existing solutions. SAS has different ways to rename the variables and its labels but here in this article … Read more

How to Rename All Datasets in SAS? (Add Prefix/Suffix to dataset names)

In this article we have seen 3 different ways to rename a sas dataset but they aren’t efficient when it comes to bulk renaming SAS Data sets.  Here you’ll learn how you can rename all the SAS datasets from a library ones for all without creating multiple copies of datasets. It means without making data … Read more

PROC MEANS in SAS (The Ultimate Guide)

The PROC MEANS procedure summarises data in descriptive statistics for variables across all the observations as well as within the groups of observations.  You can compute statistics like calculating mean, standard deviation, minimum and maximum values, and many more statistical calculations. For example, PROC MEANS does the following: calculates descriptive statistics estimates quantiles, which includes … Read more

SAS: How to check if a sub-string is present on a char variable in SAS?

This is a very common use case where we need to write code to check if a substring is present on a character variable in SAS. That substring can be a character string, a character, or any special character. Depending on the outcomes you can perform your specific operations.  You can achieve this by using … Read more

The FIND Function in SAS (FIND v/s FINDC v/s FINDW)

The FIND function in SAS searches for a specific substring in a given string or character variable and returns the position of its first occurrence.  The FIND function is mostly used where any specific character, keyword, or phrase you want to identify, and/or extract. It is especially helpful when you read raw, scattered, and long … Read more

SAS: How to Convert Character Date to Numeric Date in SAS

In this article we have already seen how you can convert char variable to numeric and numeric variable to character variable. When it comes to DATE in SAS, it’s a bit different because SAS has its own date format and informats. You can use the INPUT() function to convert a character date to a numeric … Read more

SAS: How to Use Datalines Statement (Cards/Lines) to Create a SAS Data set

The Datalines statement along with the INPUT statement is used to create a data set from scratch by entering data directly in the program, rather than data stored in an external file. You can use only one DATALINES statement in a DATA step. Use separate DATA steps to enter multiple sets of data. Basic Syntax … Read more