Data visualization with SAS programming

Proc Template colors

Reply
Frequent Contributor
Posts: 114

Proc Template colors

Hi SAS Experts,
I am defining two colors in the proc template styles.colorramp and am using it in the annotate dataset.
the startcolor=cxF3F7FE(light blue) and endcolor=cx6497EB(blue). it is working fine with the colors cxF3F7FE,cx6497EB.
But when am changing the startcolor=CXF9A11A(orange) and endcolor=CXFFD923(light orange) and using this in my annotate dataset,it is not
reffering to the newly defined colors it is still taking the blue and light blue colors.
Please help.

Below is my code.

 

 


data response_data;
input idname$ X Y age;
cards;
Cuba -20722.00205 4678.3461646 20 24
Guatemala -21079.71903 4444.6666525 26
Haiti -20480.41176 4569.4493199 28
Honduras -20942.88097 4419.9807239 32
;
run;

proc template;
define style styles.colorramp;
parent=styles.default;
style twocolorramp / startcolor=cxF3F7FE endcolor=cx6497EB;
class body / backgroundcolor=white;
class table / backgroundcolor=white;
class header, footer / backgroundcolor=white;
class data / backgroundcolor=white;
class systemtitle / backgroundcolor=white;
end;
run;

data anno;
length function style color $ 10 position $ 1 text $5;
retain flag 0 function 'label' xsys ysys '2' hsys '3' when 'a' ;
set response_data ;
color= 'black';
text=put(age,comma5.);
position = '5' ;
size = 2.5;
style = "colorramp";
output;
run;

proc gmap data=response_data map=mapsgfk.world;
id IDNAME;
choro age/annotate=anno coutline=grayaa xsize = 2 in ysize = 2 in;
run;
quit;

 

 

Regards,

Sanjay

SAS Super FREQ
Posts: 896

Re: Proc Template colors

The STYLE in annotate has to do with fonts and line patterns. To use your new style, add this statement before the PROC GMAP:

 

ods html style=colorramp;

 

Hope this helps!

Dan

Frequent Contributor
Posts: 114

Re: Proc Template colors

Hi DanH_sas,

Your suggetion helps me alot.

in my below code am creating three gmaps for 3 response data sets, and am using the same colorramp template for all the three gmaps. When I have multiple response levels in the response data set the colorramp is working fine am getting the expected colors in the output.

But when I have only one response level value or two response level values(both the values are same.) then am not getting the colors which i have mentioned in the "colorramp" instead am getting blue color in the output.

I think the issue is with the startcolor and endcolor in the colorramp.

Is there is anyway to get the colorramp colors in my output. Please help. 

 

Below is my code :

 

data response_data;
input idname$ X Y age;
cards;
Cuba -20722.00205 4678.3461646 20
Guatemala -21079.71903 4444.6666525 26
Haiti -20480.41176 4569.4493199 28
Honduras -20942.88097 4419.9807239 32
;
run;

data anno;
length function style color $ 10 position $ 1 text $5;
retain flag 0 function 'label' xsys ysys '2' hsys '3' when 'a' ;
set response_data ;
color= 'black';
text=put(age,comma5.);
position = '5' ;
size = 2.5;
style = "cumberland AMT";
output;
run;


proc template;
define style styles.colorramp;
parent=styles.default;
style twocolorramp / startcolor=CXF9A11A endcolor=CXFFD923;
end;
run;

ods pdf file="path" startpage=no;

ods pdf style=styles.colorramp;

proc gmap data=response_data map=mapsgfk.world;
id IDNAME;
choro age/annotate=anno coutline=grayaa xsize = 2 in ysize = 2 in;
run;
quit;

ods pdf startpage=now;
/*second response data which have only one response level value*/
data response_data1;
input idname$ X Y age;
cards;
Cuba -20722.00205 4678.3461646 20 
;
run;


proc gmap data=response_data1 map=mapsgfk.world;
id IDNAME;
choro age/annotate=anno coutline=grayaa xsize = 2 in ysize = 2 in;
run;
quit;

ods pdf startpage=now;
/*third response data which have two response levels but with same values*/
data response_data2;
input idname$ X Y age;
cards;
Cuba -20722.00205 4678.3461646 20
Guatemala -21079.71903 4444.6666525 20
;
run;

proc gmap data=response_data2 map=mapsgfk.world;
id IDNAME;
choro age/annotate=anno coutline=grayaa xsize = 2 in ysize = 2 in;
run;
quit;

ods pdf close;

 

 Regards,

Sanjay.

 

SAS Super FREQ
Posts: 896

Re: Proc Template colors

When the same levels are the same value, they will always be mapped to the same color. Otherwise, you would get a data-integrity issue, not knowing which color belongs to which value. If the two values are not exactly the same, you should get the two colors.

Ask a Question
Discussion stats
  • 3 replies
  • 362 views
  • 0 likes
  • 2 in conversation