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

I tried searching a few different things about deleting records but must not have been clear on what I was wanting to do because I couldn't find what I was looking for.

 

I have a data set that has client id, assessment, date, and scores by question

 

assessment either has a value of first or last

 

For each client_id they either have a first OR a first and a last

 

I want my final dataset to only include clients who had both a first and a last assessment.

 

HAVE and WANT example data attached.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
utrocketeng
Quartz | Level 8

PROC SQL;

CREATE TABLE work.WANT AS

SELECT b.*

FROM

     (SELECT client_id FROM work.HAVE WHERE assessment = 'LAST') a

     INNER JOIN work.HAVE b on a.client_ID = b.client_ID

;

QUIT;

View solution in original post

3 REPLIES 3
utrocketeng
Quartz | Level 8

PROC SQL;

CREATE TABLE work.WANT AS

SELECT b.*

FROM

     (SELECT client_id FROM work.HAVE WHERE assessment = 'LAST') a

     INNER JOIN work.HAVE b on a.client_ID = b.client_ID

;

QUIT;

ddavies
Calcite | Level 5

Thanks so much!

utrocketeng
Quartz | Level 8
glad to help out!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1169 views
  • 0 likes
  • 2 in conversation