I recreated a one to one match using the PROC SURVEYSELECT. I have the final match dataset with only 4 variables inclduing matchID in the dataset.
How do I relate this to the original dataset from where the cases and control were selected so I can work on the matched data?
You need to merge/join the two datasets in to the SurveySelect output.
You'll need to rename the variables so you can identify the match/control records. This assumes you have different datasets with your control and match data.
Proc sql;
Create table matched as
Select a.* /*first set of records Control dataset*/
B.id as match_id, b.name as match_name, .... etc, /* Match dataset, rename variables because variables cannot have the same name*/
Ss.index /*Include the variable index from the SurveySelect data*/
From SurveySelect as ss /*Match/Control dataset shown*/
Left join control as a /*Get information from control dataset, match on ID*/
On ss.control_id = a.id
Left join match as b /*Merge information from the match dataset, match on ID*/
On ss.match_id = b.id;
Quit;
Would help if you provide example have and want datasets in the form of data step code.
Art, CEO, AnalystFinder.com
I will appreciate the dataset code,
Thanks.
You need to merge/join the two datasets in to the SurveySelect output.
You'll need to rename the variables so you can identify the match/control records. This assumes you have different datasets with your control and match data.
Proc sql;
Create table matched as
Select a.* /*first set of records Control dataset*/
B.id as match_id, b.name as match_name, .... etc, /* Match dataset, rename variables because variables cannot have the same name*/
Ss.index /*Include the variable index from the SurveySelect data*/
From SurveySelect as ss /*Match/Control dataset shown*/
Left join control as a /*Get information from control dataset, match on ID*/
On ss.control_id = a.id
Left join match as b /*Merge information from the match dataset, match on ID*/
On ss.match_id = b.id;
Quit;
For future use you can use the option OUTALL on the Proc Surveyselect statement. This will add a variable SELECTED to the output set that will have a 1 for the selected records and 0 for the non-selected.
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.