Leveraging the temporary variable

Take another look at the table in the Different variable length and additional variables section. There are five variables in the output dataset. It would be helpful if we knew which observations came from the Customer_X or Customer_Y table. We will modify the program to create a Source variable that tells us which table has contributed to specific observations:

Data Customer;Set Customer_X (in = a) Customer_Y (in = b);If a = 1 then    Source = "X";Else Source = "Y";Run;

This will give the following table as the resultant output:

The IN temporary variable is only available for the duration of the data step. However, ...

Get Hands-On SAS for Data Analysis 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.