Hi Kamal,
I hope you have this query in the context of a merge.
When a SET or MERGE statement reads multiple SAS datasets, you can use IN=datatset option to keep track of the source of observations. This IN=dataset is useful only for input SAS datasets in a data step. This variable is a Boolean variable with a value of 1 if the observation contains data from that SAS dataset, 0 if it does not. You should use use dift. variable name for each datatset.
Consider this MERGE statement:
MERGE A (IN=INA) B (IN=INB);
BY X;
The variable INA and INB tell you whether each BY group is found in the two input SAS datasets. If both SAS datatsets contain the BY group, then both INA and INB have values of 1. If only A contains the BY group, then INA is 1 and INB is 0. Or if only B contains the BY group, then INA is 0 and INB is 1.
In a merge, you might want to keep observations only if the key value is present in a specific SAS datatset. Use a subsetting IF statement to select these observations. The eg. below keeps only observations that are found in A. It discards observations that are found in B.
MERGE A (IN=INA) B;
BY X;
IF INA;
note: IF INA is same as saying IF INA=1;
Hope this helps.
Thanks
Cathy