i am trying to see how many customers (by SSN) have applied for credit accross multiple customers/stores. Each store has a unique ID and each SSN is unique. I am using Enterprise Guide 5.1 and feel I shold use a Proc Freq but I need to see which unique SSN matches to more than on unique store_ID.
Is this possible with a Proc Freq or some other statement?
All of the data is in one dataset. There is a column for Store_ID and another for SSN. There are many dupllicates for both of these variables and I am trying to find the ssn's that are common in more than one store.
There is a unique record for each credit application that a customer fills out. I want to see how many stores they apply to. I de-duped by SSN and took the last record but that only gave me the store they applied for on the last application.
A single PROC FREQ won't do it, but two PROC FREQs will. The idea is that the output from the first PROC FREQ becomes the input to the second PROC FREQ:
proc freq data=have;
tables ssn * store / noprint out=unique;
run;
proc freq data=unique;
tables ssn / noprint out=want (keep=ssn count where=(count > 1));
run;
This gives you a final data set named WANT, with SSN and COUNT. COUNT is a count of how many different stores that particular SSN applied at.
I'm sure there are some clever SQL programmers out there that could do this in one step. But with PROC FREQ it takes two.
That worked perfectly, thank you. I now need to isolate the last applications for each customer for each store. I have de duped by last.app_id but that only gives me one record per customer. If the customer applied at 4 stores, I want to keep the last application entered (these are numerical) for each customer by store. If the customer went to 1 store, they would have 1 record, 4 stores 4 records etc.
I am trying to sort by store name ascending application numb er, then take the last ssn for each store but am not getting success..
It sounds like you are moving in the right direction. Try using three variables in your BY statement:
by store ssn application_no;
Then condition on last.ssn.
Alternatively:
by ssn store application_no;
Then condition on last.store.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.