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!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.