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!

Share

The Graph Guy!

Robert has worked at SAS for over a quarter century, and his specialty is customizing graphs and maps - adding those little extra touches that help them answer your questions at a glance. His educational background is in Computer Science, and he holds a BS, MS, and PhD from NC State University.

### Related Posts

1. How is there anything in the 4th one
I'm tritan color blind but the other ones were clear as day

2. 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?

3. 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 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! ;)

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

5. 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!

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

• Robert Allison on

Ripudaman - it would probably be best to see an eye doctor with your questions.

7. 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!! :-)

• Robert Allison on

Hahaha - ok Cat, I guess I'll go ahead and "fess up" - that last one doesn't really have a differently-colored ring! This is sort of a "control" that I put in - if someone claims to see the ring in all the graphs, I'll know that they're lying! ;-)

• I wish I had read the comments before staring at the screen for 10 mins! :-)

Good one Robert!

8. Well, it works :-). I can't see the shape in the fourth image - and I know I'm slightly colorblind.

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

9. 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 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! ;)