BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PeterClemmensen
Tourmaline | Level 20

Sure

 

data _null_;
   length vars $ 20000;
   do i=1 to 52-1;
      do j=i+1 to 52;
         vars = catx(' ', vars, cats('pair_', i, '_', j));
      end;
   end;
   call symputx('vars', vars);
run;

data want(keep=itempos key pair:);
   set have;
   array c {*} col:;
   array p {1326} $ 50 &vars.;
   do i=1 to 52-1;
      do j=i+1 to 52;
         idx=sum(idx, 1);
         if       c[i]=c[j]=key    then p[idx] = "same resp and both wrong";
         else if  c[i]=c[j] ne key then p[idx] = "same resp and both wrong";
         else if  i=key | j=key    then p[idx] = "different resp and one of them correct";
         else                           p[idx] = "different resp and both wrong";
      end;
   end;
run;
superbug
Quartz | Level 8

@PeterClemmensen 

it worked!

Thanks much for your reply!

I very much appreciate your time and help!!

 

superbug
Quartz | Level 8

@novinosrin 

Thanks much for the explanation and teaching!

very much appreciate your help!

superbug
Quartz | Level 8

oops, here is the file. 

novinosrin
Tourmaline | Level 20

Seems like you reposted a duplicate of https://communities.sas.com/t5/SAS-Programming/How-to-write-SAS-code-about-this-combination/m-p/6256...

 

My apologies if my solution didn't work for you. 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

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
  • 19 replies
  • 5342 views
  • 0 likes
  • 3 in conversation