*
;

/*
> Along time ago someone submitted a sas macro which produced all 255
> shades of gray ... does anyone have a copy of it ?

No, but here's another one. You give it a data set listing the color
names you want, and tell it how many rows and columns of color samples
you want on a page, and away it goes. Complete program is included below.

Andrew Smith
University of Reading
*/

%macro colors(colors, rows, cols);
  data annodata;
    set &colors;
    count = mod(_n_-1, &rows*&cols)+1;
    page + (count=1);
    call symput("pages", compress(put(page,best.)));
    row = mod(ceil(count/&cols)-1,&rows) + 1;
    col = mod(count-1, &cols);
    xsys = '5';
    ysys = '5';
 
    function = 'MOVE    ';
    x = 100 * (col/&cols);
    y = 100 * (1-row/&rows);
    output;
 
    function = 'BAR    ';
    x = x+ 100/&cols - 0.5;
    y = y+ ( 90 - 4*&rows)/&rows;
    color = colornam;
    style = 'solid   ';
    output;
 
    function = 'LABEL';
    text = colornam;
    size = 0.7;
    style = '';
    x = 100 * (col/&cols);
    position = '3';
    color = '';
    output;
 
  run;
 
  data _null_;
    set annodata;
    by page;
    if first.page then put 'NOTE: ' page 3. '  ' colornam $10. @;
    if last.page then put colornam $10.;
  run;
 
  %do page = 1 %to &pages;
    %put NOTE: page &page of &pages;
    data annopage;
      set annodata;
      if (page=&page);
    run;
    proc gslide border annotate=annopage;
    * note "&page of &pages  &sysday &sysdate &systime";
      title1 h=1 f=none "SAS &sysver &sysscp &page/&pages &sysdate";
    run;
  %end;
%mend colors;

*Example;

data grays;
  do i = 0 to 255; colornam = 'gray' || put(i, hex2.); output; end;
  keep colornam;
run;

%colors(grays, 16,16);

*
;