BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
meetagupta
Fluorite | Level 6

Below is the dataset and I have to pick customer_id who have submitted ADDRESS and ID proof but not submitted INCOME proof. How can I choose those obs? For example, Custome_id 3 is the only one who have not submitted income proof.

Thanks.

 

customer_id     proof

    1                     income

    1                      id

    1                      id

    2                     address

    2                      income

   2                         id

   3                       address

    3                      address

    3                        id

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
proc sql;
create table want as
select distinct ID
from have
where id not in (select distinct ID from have where proof = 'income');
quit;

You can use SQL for this nicely. 

Remember that text comparisons are case sensitive.

 


@meetagupta wrote:

Below is the dataset and I have to pick customer_id who have submitted ADDRESS and ID proof but not submitted INCOME proof. How can I choose those obs? For example, Custome_id 3 is the only one who have not submitted income proof.

Thanks.

 

customer_id     proof

    1                     income

    1                      id

    1                      id

    2                     address

    2                      income

   2                         id

   3                       address

    3                      address

    3                        id

 


 

View solution in original post

4 REPLIES 4
Reeza
Super User
proc sql;
create table want as
select distinct ID
from have
where id not in (select distinct ID from have where proof = 'income');
quit;

You can use SQL for this nicely. 

Remember that text comparisons are case sensitive.

 


@meetagupta wrote:

Below is the dataset and I have to pick customer_id who have submitted ADDRESS and ID proof but not submitted INCOME proof. How can I choose those obs? For example, Custome_id 3 is the only one who have not submitted income proof.

Thanks.

 

customer_id     proof

    1                     income

    1                      id

    1                      id

    2                     address

    2                      income

   2                         id

   3                       address

    3                      address

    3                        id

 


 

meetagupta
Fluorite | Level 6

Thank you very much. it worked.

novinosrin
Tourmaline | Level 20

CustomerID  1 doesn't seem to have submitted ADDRESS proof either?

 

So 1 shouldn't qualify right?

meetagupta
Fluorite | Level 6

I only wanted customers who have not submitted Income proof. thanks

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 396 views
  • 0 likes
  • 3 in conversation