Checking for an ID in Each of Two Files

One requirement of a large project may be that a particular ID value exists in each of several SAS data sets. Let’s start out by demonstrating how you can easily check that an ID is in each of two files. This will be generalized later to include an arbitrary number of files.

The technique demonstrated in this section is to merge the two files in question, using the ID variable as a BY variable. The key to the program is the IN= data set option that sets a logical variable to true or false, depending on whether or not the data set provides values to the current observation being created. An example will make this clearer. In Program 6-1 are the SAS statements to create two SAS data sets for testing purposes. ...

Get Cody’s Data Cleaning Techniques Using SAS® Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.