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!

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
  • 3 replies
  • 580 views
  • 0 likes
  • 2 in conversation