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!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.