Desktop productivity for business analysts and programmers

SAS EG: Excluding a data set

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 104
Accepted Solution

SAS EG: Excluding a data set

I'm trying to exclude a list of individuals that show up in the tables named - clmspull and enroll. The point is to exclude those with diabetes because we are looking for those who have gotten diabetes screenings.

 

I saved the list as a permanent data set called "diabexc". I know I do a merge somewhere, for ex:

 

data excdiab; /*new data set that will exclude the diabetics*/

    merge diabexc (IN=a) clmspull (IN=b) enroll (IN=c);

    by edipn; /*this is the column that all three tables have in common*/

run;

 

I'm not sure if this is right, I feel like I'm on the right track....We just want these people removed from the data.

 

This is due today so I am frantic. Any help you can provide is greatly appreciated! Thank you.


Accepted Solutions
Solution
3 weeks ago
Super User
Posts: 9,867

Re: SAS EG: Excluding a data set

Basic idea good, but the details ...

data clmspull_new;
merge
  diabexc (IN=a keep=edipn)
  clmspull (IN=b)
;
by edipn;
if b and not a;
run;

Same for the other dataset.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

View solution in original post


All Replies
Solution
3 weeks ago
Super User
Posts: 9,867

Re: SAS EG: Excluding a data set

Basic idea good, but the details ...

data clmspull_new;
merge
  diabexc (IN=a keep=edipn)
  clmspull (IN=b)
;
by edipn;
if b and not a;
run;

Same for the other dataset.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Frequent Contributor
Posts: 104

Re: SAS EG: Excluding a data set

Posted in reply to KurtBremser
Thank you. Can you explain what IF B and Not A means?
Frequent Contributor
Posts: 104

Re: SAS EG: Excluding a data set

Oh I think I see, output if not in A?
Super User
Posts: 9,867

Re: SAS EG: Excluding a data set


@essdee wrote:
Oh I think I see, output if not in A?

Actually "proceed with the rest of the data step if not in dataset associated with variable a".

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Frequent Contributor
Posts: 104

Re: SAS EG: Excluding a data set

Posted in reply to KurtBremser
Ok great thank you!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 100 views
  • 0 likes
  • 2 in conversation