Hello,
I have two variables BEGIN and END in a dataset A, and Dataset B has a variable called DIAGNOSIS CODE. I would like to see if any value in the diagnosis code variable falls in the range between Begin and End variable.
Example:
Dataset A(Have) Dataset B(Have) Dataset C(want)
Begin End Diagnosis code Flag
1 3 5 2
7 10 2 17
16 24 11
17
Thanks for all your help!
Like this?
proc sql; select CODE as FLAG from HAVE1, HAVE2 where CODE between BEGIN and END;
Like this?
proc sql; select CODE as FLAG from HAVE1, HAVE2 where CODE between BEGIN and END;
Thanks very 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.