Help using Base SAS procedures

members who have changed their Emailable Status only once. Means from No to Yes and Yes to No and not from y to y and n to n. and wanted to calculate distinct new mbr id as Active members on the basis of it

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

members who have changed their Emailable Status only once. Means from No to Yes and Yes to No and not from y to y and n to n. and wanted to calculate distinct new mbr id as Active members on the basis of it

members who  have changed their Emailable  Status only once.

Means from No to Yes and Yes to No and not from y to y and n to n.

and wanted to calculate distinct new mbr id as Active members on the basis of it and


for refrence please see the attached data file.



Attachment

Accepted Solutions
Solution
‎11-25-2015 05:17 AM
Super User
Super User
Posts: 7,430

Re: members who have changed their Emailable Status only once. Means from No to Yes and Yes to No and not from y to y and n to n. and wanted to calculate distinct new mbr id as Active members on the basis of it

Its really easier to put in a test datastep with some values and required output.  From what I can gather something like:

proc sql;

     create table WANT as

     select     distinct(A.MBR_ID)

     from       HAVE A

     where     exists(select distinct MBR_ID from HAVE where RESULT="YES")

          and    exists(select distinct MBR_ID from HAVE where RESULT="NO");

quit;

View solution in original post


All Replies
Solution
‎11-25-2015 05:17 AM
Super User
Super User
Posts: 7,430

Re: members who have changed their Emailable Status only once. Means from No to Yes and Yes to No and not from y to y and n to n. and wanted to calculate distinct new mbr id as Active members on the basis of it

Its really easier to put in a test datastep with some values and required output.  From what I can gather something like:

proc sql;

     create table WANT as

     select     distinct(A.MBR_ID)

     from       HAVE A

     where     exists(select distinct MBR_ID from HAVE where RESULT="YES")

          and    exists(select distinct MBR_ID from HAVE where RESULT="NO");

quit;

🔒 This topic is solved and locked.

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

Discussion stats
  • 1 reply
  • 157 views
  • 1 like
  • 2 in conversation