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!
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;
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;
Thanks so much!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.