Return to Archive

SAS Tip of the Month
April 2005

Finding that you have multiple records for a customer when you only expect a single record is frustrating. Below is an example of a piece of SAS code that will print those customers where your dataset has multiple records:

    proc sort data=salesdb;
        by custid;
    run;
    data multiple;
        set salesdb;
        by custid;
        if sum(first.custid,last.custid)^=2 then output;
    run;
    title1 "Mulitple Record Report from Sales Database";
    proc print data=multiple;
        by custid;
    run;
________________________________
Updated April 15, 2005