Using SAS to test for color blindness

17

I'm always trying to find new uses for SAS - this time I've written a proof-of-concept that shows how you might use SAS to create charts that test for color blindness. If nothing else, I think it's a fun example :)

First, I did a Google search, and looked at several online tests for color blindness. Most of them show an array of dots of varying size and color, and there is a pattern 'hidden' in the dots that only someone who can properly distinguish all the colors being used can see. There are several different types of color blindness, and different color combinations are used to test for each.

To implement something similar in SAS, I decided to re-use one of my Wafer Map examples (specifically this one). To create this circular grid of boxes of varying sizes, I create a 50x50 grid of gmap rectangular-shaped areas (think of each rectangle as a state in the US map), and then throw out all the rectangles that were farther than a certain distance from the center of the page. I then programmatically assign a color/response variable based on the position of the rectangles, to form the desired pattern. If a rectangle is part of the pattern, I randomly assign it 1, 2, or 3 and otherwise it is randomly assigned a value of 4, 5, or 6. I then arrange the 6 desired colors in my pattern statements.

After a bit of tweaking and fine-tuning, I came up with my final code that created the following color blindness test charts:

How'd you do on the test?  Were you able to see the shape in all four charts?

Of course, this is just a proof-of-concept I designed to show the flexibility of SAS/GRAPH (and specifically Proc Gmap) - please don't rely on my test to determine whether you're colorblind! Hopefully in the hands of a doctor or researcher who specializes in vision and color blindness, my code could be used to set up some much better tests!

 

Tags sas/graph
Share

About Author

Robert Allison

The Graph Guy!

Robert has worked at SAS for over 20 years, and is perhaps the foremost expert in creating custom graphs using SAS/GRAPH. His educational background is in Computer Science, and he holds a BS, MS, and PhD from NC State University. He is the author of several conference papers, has won a few graphic competitions, and has written a book (SAS/GRAPH: Beyond the Basics).

17 Comments

  1. Chris Hemedinger
    Chris Hemedinger on

    I'm not color-blind; if I didn't know that before, I know it now thanks to your test.

    Can you devise a test for detecting "fashion sense"? I'm told that I might have a disability in that area.

    • Robert Allison
      Robert Allison on

      With the time I spent at the NCSU College of Textiles, I should be able to come up with something! ... it might lean towards Scottish tartans, or double-weaves, though! ;)

    • Robert Allison

      Note that the 4th image might be a little 'tricky' ... (I might have cheated a little on that one, as an experimental control/test) ;)

  2. Catherine Truxillo

    Please tell me the 4th one is just gray/grey... because I've never thought I was color blind but I see no ring in #4. Time to make an appt with the eye doctor!! :-)

  3. RIPUDAMAN MISHRA on

    SIR SUGGEST ME THE TREATMENT OF COLOR BLINDNESS BECAUSE AT MY CHILDHOOD;MY AIM WAS TO JOIN ARMY BUT DUE TO COLOR BLINDNESS I ALWAYS DISMISSED FROM MEDICAL EXAM. I AM FROM INDIA STATE U.P. DIST BALLIA MB.NO.+917860440027
    SIR,I REQUEST YOU TO SUGGEST ME SOON ANY ADVISE ABOUT THESE DISEASE

  4. KAUSHAL KISHOR on

    OMG! firstly i thought that i am color blind because i was unable to interpret the #4 image :P But after reading the comments i realized that i am perfect ;)
    Thanks Sir!

  5. Other than the very last circle, I saw all of the shapes. So the good news is I'm almost 100% sure I'm not color blind. That is a fun experiment to do to test your eyes though. I need to get my son tested soon, as color blindness runs in his dad's family. I'm going to forward this to him and see if he passes.

  6. I'm not colour blind because I see nothing on the forth one but my dad of the other hand can see a grey circle some how

    • Robert Allison
      Robert Allison on

      Either your dad is seeing in some extra spectrum that the rest of us aren't seeing ... or maybe he's pulling your leg! ;)

  7. the first one i didnt see until i saw 2 and 3 were circles/rings and then i faintly made out a ring in the 1st so am i color blind?

Leave A Reply

Back to Top