BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Reeza
Super User

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.

shellp55
Quartz | Level 8

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.

Reeza
Super User
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.

Reeza
Super User
It's leave or break...you can test them 😉
shellp55
Quartz | Level 8

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;

Reeza
Super User

Change your sample data to better reflect your actual data and then I can test it. Otherwise, I'm guessing.

Reeza
Super User

@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. 

shellp55
Quartz | Level 8

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.

 

 

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 22 replies
  • 4417 views
  • 0 likes
  • 4 in conversation