Hi
Is there is a way to check the list of colors in sas graphs
Like the below colors;
pattern1 v=solid color=cx9999ff; /* light blue */
pattern2 v=solid color=cx993366; /* purplish */
pattern3 v=solid color=cxffffcc; /* pale yellow */
Hi:
Here is the doc on the list of pre-defined colors in the SAS registry. The list shows that if you use a name like "AliceBlue" for example, you will get the hex RGB value of: CXF0F8FF and the HLS value of: H148F8FF -- the list is very neat because you can see the shade you're getting:
http://support.sas.com/documentation/cdl/en/graphref/67881/HTML/default/viewer.htm#n161ukdyz9wpfsn1n... and here's the site that shows the "rainbow" organized by hue: http://support.sas.com/documentation/cdl/en/graphref/67881/HTML/default/viewer.htm#n161ukdyz9wpfsn1n...
You can always write a program to display all the hex values and their equivalent colors, but that would be a huge list. If you have a special color scheme that you need to match for your company, the people who know the Pantone colors for your company logo (for example) will also know the RGB, CMYK and HLS values for the company colors.
cynthia
Are you talking about ODS graphics or SAS/GRAPH traditional graphisc?
For ODS graphics, the colors come from styles and templates. The styles determine the attributes for lines, markers, fonts, etc. If you know the style that you are using, use the SOURCE statement in PROC TEMPLATE to display the attributes, like this for the HTMLBlue style:
proc template;
source Styles.HTMLBlue;
run;
Hi:
Here is the doc on the list of pre-defined colors in the SAS registry. The list shows that if you use a name like "AliceBlue" for example, you will get the hex RGB value of: CXF0F8FF and the HLS value of: H148F8FF -- the list is very neat because you can see the shade you're getting:
http://support.sas.com/documentation/cdl/en/graphref/67881/HTML/default/viewer.htm#n161ukdyz9wpfsn1n... and here's the site that shows the "rainbow" organized by hue: http://support.sas.com/documentation/cdl/en/graphref/67881/HTML/default/viewer.htm#n161ukdyz9wpfsn1n...
You can always write a program to display all the hex values and their equivalent colors, but that would be a huge list. If you have a special color scheme that you need to match for your company, the people who know the Pantone colors for your company logo (for example) will also know the RGB, CMYK and HLS values for the company colors.
cynthia
Thats a great information
Thank you Cynthia
Hi Cynthia
I want draw a stacked bar graph, is there is any useful link or any information regarding this.
Hi Cynthia,
Could please help me in this.
I am adding the word document as a cover page in ods pdf file.
I have converted the word to pdf and used in my progrm. But am getting the error. Please help me
Below is the error:
Error: Unable to load image C:\temp\test.pdf; default image will be used instead
Following is my code
ods pdf file='path.pdf' notoc startpage=no color=full style=colorramp;
ods pdf text='^{style[preimage="C:\temp\test.pdf"}';
ods pdf startpage=now;
goptions hsize=3.99 in vsize=4.2 in;
proc print data=sashelp.class;
goptions horigin=0 in vorigin=4 in;
run;
proc means data=sashelp.class;
goptions horigin=4.25;
var height;
run;
ods pdf close;
Hi:
Offhand, I'd say your issue is that the PREIMAGE and POSTIMAGE style attributes expect an image file. A PDF file is NOT an image file -- it is a proprietary, binary format file that represents a document as it would be sent to a printer. This is not an image file, like a PNG or a JPG or a GIF file.
It is probably inappropriate to use an entire PDF file the way you do with ODS TEXT, too. I'm not certain, but to me, this seems to be a question for Tech Support.
You say you want a cover page on your document, but don't show what it is supposed to look like. I generally create my cover pages with PROC REPORT.
Also, I don't understand the use of GOPTIONS in your code. Where are your SAS/GRAPH procedures?? The GOPTIONS really don't serve a purpose because they are not used by PROC PRINT or PROC MEANS.
cynthia
Here's a cover page created with PROC REPORT:
And, here's the code that created the above image:
data cover;
length line $100;
do ord = 1 to 5;
line = ' ';
output;
end;
ord=6;
line='This is My Cover Page';
output;
do ord = 7 to 11;
line = ' ';
output;
end;
ord=12;
line = 'Report for My Department';
output;
ord=13;
line = ' ';
output;
ord=14;
line='by Ima Programmer';
output;
run;
options nodate nonumber;
ods pdf file='c:\temp\with_cover.pdf' notoc style=pearl startpage=no;
proc report data=cover noheader
style(report)={width=100% rules=none frame=void cellspacing=0};
column ord line;
define ord / order noprint;
define line / display;
compute line;
if ord = 6 then do;
call define(_col_,'style','style={font_size=18pt font_weight=bold font_face="Helvetica" just=c}');
end;
else if ord in (12,14) then do;
call define(_col_,'style','style={font_size=12pt just=r}');
end;
else do;
call define(_col_,'style','style={font_size=12pt just=c}');
end;
endcomp;
run;
ods pdf startpage=now;
ods pdf;
run;
proc print data=sashelp.class;
run;
proc means data=sashelp.class;
var height;
run;
ods pdf close;
Thank you Cynthia,
It helps me
Hi Cynthia,
Could you please help me in this.
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
Hi:
You do not show your ODS invocation statement, but the STYLE=COLORRAMP does not belong in the ANNO dataset. When I make a style template and use the style template in my ODS HTML statement, I do see the orange colors being used. The style= option in the ANNO dataset is, in your example, a specification for the FONT you want the text to have (you already specify the color as black), so it is not appropriate to use COLORRAMP where you originally show it.
cynthia
Hi Cynthia,
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 Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.