array1 should be the smaller list.
This doesn't account for missing though so you may want to add a filter for missing to stop the DO loop.
Got it, makes sense because it is matching blank to blank and considers that a match. Sorry for being dense but not sure how to add that filter...but I will search the site. Thanks again for all your help.
if missing(_proc1(i)) then leave;
I think you add that into the top of the do loop.
This does assume that once you find a missing value all other values will be missing, which is pretty much how I recall medical data being formatted.
Thanks Reeza! I've tried the code in various spots but it still shows as zero cases and I know there are some matching the criteria.
I've used:
do I = 1 to dim(_proc1);
find_index=whichc(_proc1(i) of _proc2(*));
if missing(_proc1(i)) then leave;
else if find_index>0 then do;
if _date1(i)=_date2(find_index) then flag=1;
end;
end;
Change your sample data to better reflect your actual data and then I can test it. Otherwise, I'm guessing.
@shellp55 You can also email me the sample data if you don't want to post it publically. I *think* I've worked with you before as a consultant and have a privacy contract that would still cover this.
Thanks Reeza but it will take awhile to de-identify my data. I think you are correct that it is the blank values because I changed my test data so that there is no data in _proc1 and _date1 and it erroneously flagged the case as matching my criteria. i'm trying to use if not missing(px1) to include an 'else if missing(_proc1(i)) then leave but I get an error that I do not have a matching do/select statement.
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.