Hi, (Using SAS 9.3 (TS1M1) via SAS Enterprise Guide 5.100.0.12019) (64-bit) on Windows 7 Pro) I would like make use of a user defined PICTURE format to form the column labels in a bar chart. I want my columns to be labelled in <yyyy>-<mm> format, such as 2014-07 for any event occurring in Jul-2014. However, when I run PROC GChart out to any of main ODS destinations and using any Graph Format setting (ActiveX, PNG, GIF etc.), the results are not what I expected. For example, when using ODS destination of HTML and Graph Format of ActiveX, my chart shows a single column with a label that looks like this snippet shows: Just one big column, where I expected one column per <yyyy>-<mm> combination in my data, and, the label is simply the text of the directives comprising my PICTURE format, whereas I was hoping for 2014-07, 2014-08, 2014-09 etc. However, when I run the same code out to the ODS SAS Report destination, I get three columns, which is great, but the columns are labelled like this snippet shows, which is not so great: The SASLOG shows a single warning as: WARNING: The intervals on the axis labeled SalesDate are not evenly spaced. however, in this case I do not think that this is material. There is a currently unanswered SAS Communities posting that raises similar behaviour but that was concerning the Graph Template Language () , whereas this is bog standard SAS and Proc GChart and the trail went cold on that other posting in 2011. I have put together a simple set of SAS code to show the definition of the PICTURE format, proof that the format works OK when used to format a value in the SASLOG with a PUT statement and then the Proc GChart code that I am using. If anyone can spot what I am doing wrong here I would appreciate some assistance. I know that there are a million workarounds for using dates in SAS/Graph, but in this case I know that it should work and I want to keep my date values as proper date values, not convert them to character. My sample code is shown below. The two FORMAT statements in the final Proc CGhart can be flipped around to show that, when using a built-in SAS format (YYMON8.), the columns group correctly and are labelled correctly. However using the user-defined PICTURE format DATE_GROUPING. the columns do not behave as I expected them to. Cheers, Downunder Dave Welllington. Options LINESIZE=145; *********************************************************************************; *Create a custom Picture format to represent date values as <yyyy>-<mm> ; *e.g. 2014-07 for any date falling in July 2014. ; *********************************************************************************; Proc Format Library=WORK; Picture Date_Grouping Low-High= '%Y-%0m' (DataType=DATE); Run; *********************************************************************************; *Prove that it works with some sample data.... ; *********************************************************************************; Data Sales_Details; Input SalesDate Date9.; Put SalesDate=Date9. SalesDate=Date_Grouping9.; Datalines; 04Jul2014 13Jul2014 28Aug2014 11Aug2014 15Aug2014 06Sep2014 06Sep2014 06Sep2014 ; Run; *********************************************************************************; *Create a simple bar chart. ; *********************************************************************************; Axis1 STYLE=1 WIDTH=1 MINOR= (NUMBER=1); Axis2 STYLE=1 WIDTH=1; Title1 "Sales Bar Chart"; Proc GChart Data=Work.Sales_Details; VBAR SalesDate / CLIPREF FRAME DISCRETE TYPE=FREQ COUTLINE=BLACK RAXIS=AXIS1 MAXIS=AXIS2; /* Format SalesDate YYMON8.;*/ Format SalesDate Date_Grouping9.; Run;
... View more