BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
olsengf
Fluorite | Level 6

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

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

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

DanH_sas
SAS Super FREQ

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

olsengf
Fluorite | Level 6

Thank you! This worked perfectly!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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