Data visualization with SAS programming

GTL template defining axis as integers

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

GTL template defining axis as integers

I have a Macro template for my graphs:

/*Generic GTL template for line graphs*/
%Macro CreateTemplate(statGraphName, yaxisOption, groupText, dataLabelText, rollNameText, /*linecolor,*/ yColumn);
/*color campus line graphs*/
%let colorline = %str(lineattrs = (pattern =1 thickness = 1));
%let colorsymbol = %str();

/*template*/
proc template;
define statgraph &statGraphName;
dynamic TITLE1 TITLE2;
begingraph;
entrytitle halign=left TITLE1;
entrytitle TITLE2;
layout overlay / xaxisopts =(label = ' ') &yaxisOption walldisplay=(fill);
seriesplot x=Fiscal_Year y=&yColumn / group=&groupText name='a' index=index display=all datalabel=&dataLabelText
&colorline &colorsymbol
&rollNameText;
endlayout;
endgraph;
end;
run;
%Mend;

 

And it is called with the following code:

%CreateTemplate(ProposalsDollarTemplate, %str(yaxisopts =(label = ' ' linearopts=(viewmin=0))), none, none,
%str(ROLENAME=(Year=Fiscal_Year)
TIP=(Year Y ) tiplabel=(Year="Fiscal Year" Y="# Proposals" )), _FREQ_);

 

/*display graph*/
proc sgrender data= ProposalsCombinedSummary template=ProposalsDollarTemplate;
dynamic title2="# of &currentOrg Proposals Submitted-Fiscal YTD";
run;

 

Currently my graph is showing the x axis with decimal values (see image), and I want to display intergers only. Is there an easy option to add to my template to specifiy interger values? The actual values on the x axis will change, so I don't want any hard-coded values.graph.pngi

 

 


Accepted Solutions
Solution
‎01-19-2016 01:12 PM
SAS Super FREQ
Posts: 925

Re: GTL template defining axis as integers

In the LINEAROPTS of the axis options, there is an option called INTEGER=true | false that does just what you want.

View solution in original post


All Replies
Super User
Super User
Posts: 7,682

Re: GTL template defining axis as integers

Hi,

 

Not sure I undertand.  Why do you have all the macro code there?  Why not just use the flexibility of dynamic variables, and conditional logic in the template.  As for your axis, why not just take round min - round max plus some window (maybe 10% of the range between min/max), again use a dynamic variable:
proc sgrender data= ProposalsCombinedSummary template=ProposalsDollarTemplate;
  dynamic title2="# of &currentOrg Proposals Submitted-Fiscal YTD"

              range_low=&min. range_high=&max. range_window=&window.;
run;

Solution
‎01-19-2016 01:12 PM
SAS Super FREQ
Posts: 925

Re: GTL template defining axis as integers

In the LINEAROPTS of the axis options, there is an option called INTEGER=true | false that does just what you want.

Occasional Contributor
Posts: 7

Re: GTL template defining axis as integers

Thank you! This worked perfectly!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 357 views
  • 2 likes
  • 3 in conversation