/* matching colors in SAS from Excel and PPT */ OPTIONS NOTES SOURCE SOURCE2 MPRINT MLOGIC MERROR SYMBOLGEN; %macro RGBHex(rr,gg,bb); %sysfunc(compress(CX%sysfunc(putn(&rr,hex2.)) %sysfunc(putn(&gg,hex2.)) %sysfunc(putn(&bb,hex2.)))) %mend RGBHex; %RGBHex(247,237,212); /* Output to logfile the correct decimal colors for SAS. ignore error message. See chart of RGB colors and Hex... http://www.tayloredmktg.com/rgb/ */ goptions reset=all border cback=white htitle=12pt htext=10pt; GOPTIONS ftext='arial' htext=8pt; data mydata; infile datalines dsd; /*adding this line to help with input - MSW*/ input Quarter $ VARX1 VARX2; datalines; 1999.1 , 36306.57525 , 1.906998163 1999.2 , 37339.03992 , 1.903652899 1999.3 , 37704.84942 , 1.900266451 1999.4 , 37271.53222 , 1.905815808 2000.1 , 37129.1574 , 1.91277815 2000.2 , 36291.92406 , 1.904370998 2000.3 , 36855.66651 , 1.894674413 2000.4 , 37108.51923 , 1.899873331 2001.1 , 38561.27193 , 1.906546262 2001.2 , 39352.77252 , 1.902315168 2001.3 , 39129.76871 , 1.897003555 2001.4 , 39668.33405 , 1.898237952 2002.1 , 38763.67935 , 1.903115635 2002.2 , 39156.0024 , 1.902503491 2002.3 , 39371.91248 , 1.903317437 2002.4 , 39538.05697 , 1.906584826 2003.1 , 39554.92979 , 1.908325786 2003.2 , 40427.71907 , 1.902963254 2003.3 , 40722.65347 , 1.897867296 2003.4 , 40759.88167 , 1.906621517 2004.1 , 39886.72127 , 1.912480502 2004.2 , 40210.11928 , 1.909493165 2004.3 , 40950.92228 , 1.910349418 2004.4 , 40813.99718 , 1.916401968 2005.1 , 40429.71777 , 1.921427914 2005.2 , 41087.42318 , 1.92621911 2005.3 , 42093.80922 , 1.933163482 2005.4 , 43347.54583 , 1.941673968 2006.1 , 45321.52881 , 1.949542358 2006.2 , 45678.39745 , 1.954721059 2006.3 , 45899.74665 , 1.962862013 2006.4 , 46418.31749 , 1.97606448 2007.1 , 47311.03129 , 1.980388051 2007.2 , 47186.58605 , 1.977116544 2007.3 , 47068.05282 , 1.977984029 2007.4 , 46854.93145 , 1.984938134 2008.1 , 47280.45169 , 1.988384112 2008.2 , 47362.57202 , 1.985599325 2008.3 , 47735.99525 , 1.982306102 2008.4 , 47630.82425 , 1.975569898 2009.1 , 46163.86057 , 1.96092936 2009.2 , 47935.88912 , 1.950902179 2009.3 , 48001.01973 , 1.943506282 2009.4 , 48405.52817 , 1.938244464 2010.1 , 47668.7056 , 1.943683747 2010.2 , 48044.05415 , 1.939936752 2010.3 , 47645.0093 , 1.921955818 2010.4 , 47479.95515 , 1.919818418 ; run; data mydata; set mydata; datevar=input(put(compress(tranwrd(quarter,'.','q')),6.),yyq6.); format datevar yyq8.; run; /* Define the starting and ending dates */ /* of recent economic recession periods. */ data recessions; input startdate enddate; format startdate enddate yyq6.; datalines; 14976 15249 17440 17988 ; run; /* ---------------------------------------------------- Create an Annotate data set to shade the background of the graph to highlight the recession periods. -------------------------------------------------- */ data annorec; length function style color $8; retain xsys '2' ysys '1' when 'b'; set recessions; function='move'; x=startdate; y=0; output; function='bar'; x=enddate; y=100; color='ltgray'; style='solid'; output; run; %macro simplelinegraph; title1 font=arial color=CX696969 height=16pt "Simple Line Graph" ; footnote1 height=8pt justify=l ls=0.5 "(Economic Recessions Shaded)"; axis1 order=('01jan99'd to '01Dec10'd by year) label=none color=CX948671 value=(color=CX948671) minor=(n=3); axis2 label=(color=CX948671 angle=90 "Variable Description") value=(color=CX948671) ; symbol1 interpol=join color=blue width=2; symbol2 interpol=join color=orange width=2; symbol3 interpol=join color=red width=2; symbol5 interpol=join color=green width=2; symbol6 interpol=join color=vibg width=2; symbol7 interpol=join color=black width=2; legend1 label=('') shape=bar(6,1); GOPTIONS DEVICE=gif xpixels=600 ypixels=400; goptions border cback=white gunit=pct htext=3.5 ftitle="arial/bold" ftext="arial"; GOPTIONS GSFNAME = OutFile GSFMODE = REPLACE DEVICE = GIF FTEXT = 'ARIAL' HTEXT = 3.5; FILENAME Outfile "c:\SimpleGraph.gif"; proc gplot data=mydata; plot VARX1*datevar /legend=legend1 overlay autovref lvref=100 caxis=CX948671 cvref=CX948671 cframe=CXF7EDD4 haxis=axis1 vaxis=axis2 annotate=annorec; format datevar year4.; run; quit; %mend simplelinegraph; ods pdf file="c:\test1.pdf" notoc; %simplelinegraph; ods pdf close;