Here is IML code. I believe it would be very fast. data data_x; input (Primary col1 col2) ($); cards; nex1 nex2 nex3 nex2 nex1 nex3 nex3 nex1 nex2 ; run; data data_y; input nex1 nex2 nex3; cards; 1 0 1 0 0 0 3 1 0 1 2 1 0 0 1 ; run; proc iml; use data_x nobs nobs_x; read all var _all_; close; use data_y; read all var _all_; close; want=j(nobs_x,2,.); do i=1 to nobs_x; p=value(Primary[i]); temp_p=(p >= 1); c1=value(col1[i]); temp_c1=(c1 >= 1); want[i,1]=sum((temp_p+temp_c1)=2); c2=value(col2[i]); temp_c2=(c2 >= 1); want[i,2]=sum((temp_p+temp_c2)=2); end; create want from want; append from want; close; quit;
yes, it seems very fast. It works exactly as wanted. I think i need to get used to proc iml. what could be a good starting point? Thanks for all your efforts!
Ha. Here is Rick's blog. You can start with it : http://blogs.sas.com/content/iml/page/41
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: