BASE SAS Programming – Using DLM and DSD Options Together

Hi fellow data analysts. We are having a lot of fun putting together these posts for “BASE SAS Tutorial” series. We certainly hope you are enjoying and learning something from them as well. We have covered some very important ground so far but we have a long way to go. In this post, we will be discussing a possible scenario where are demonstrate the use of the DLM and DSD option together.

We have seen features of the DSD option. It is important to note that they all work independent of each other. For instance, if we were to set the delimiter as “/” using the DLM option, an accompanying DSD option would still identify missing values between consecutive delimiters without resetting the default delimiter to comma. Let us look at the sample data we would be using for this demo.

Sample Data

The below provided sample SAS program is used to read in the above sample data.

data sample1;
infile ‘/folders/myshortcuts/myFolder/Sample data – CSV.txt’ dsd dlm = “/”;
input gender $ Age Height Weight;

Note: We are using the DSD and DLM options simultaneously in order to read in data from a delimited file with the delimiter “/”. The DSD option is useful to identify the missing values in the data. The outputs generated from this code are:



As can be seen in the above screenshots, the data is read in appropriately. This combination is used so often in a day to day scenario that it is a must to learn, understand and deploy as if it were your second nature. Often, folks get confused, but with practice it is fairly easy to use and implement. Keep practicing by creating other sample data sets and see how the codes responds to changes.

Please find relevant reference books in the sidebar of this post, if you should want to purchase the same for further studying. BASE SAS Certification guide and the Little SAS book are extremely useful for preparation and also act as a wonderful reference for SAS concepts.

Please sign up for our newsletter, so that we may keep you posted on the latest activity on our website and Youtube channel.