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

Hey everyone,

 

I would like a graph with tick marks inside and all around.

 

So I started to add another X and Y axes with this code:

proc sgplot data = Sample;
	xaxis values=('30Jun1930'd to '30Jun2020'd);
	yaxis values=(-3 to 18 by 1);

/* 2nd X and Y axes */
	x2axis values=('30Jun1930'd to '30Jun2020'd) display=(nolabel novalues);	
	y2axis values=(-3 to 18 by 1) display=(nolabel novalues);

	series y=ln_Wealth_Portfolio x=Date / x2axis y2axis;
	series y=ln_Wealth_Index x=Date;
	format Date YEAR4.;
	keylegend / location=inside position=topleft down=2;
run;

But I did not find how to draw the tick marks inside. I read somewhere: "If you specify a negative number, tick marks are drawn inside the axis" but I don't know how to do it, and I have dates on my X-axis...

 

Could you help me please?

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

Rick is correct that SGPLOT does not expose such an option.  However, GTL supports TICKSTYLE=Outside | Inside | Across.  If necessary, you could export the GTL from the SGPLOT procedure (use tmplout option) and then add this option to the xaxisopts option bundle.

 

proc template;
  define statgraph class;
  begingraph;
    layout overlay / xaxisopts=(tickstyle=inside);
      scatterplot x=height y=weight;
    endlayout;
  endgraph;
end;
run;

 

proc sgrender data=sashelp.class template=class;
run;

 

Spider1.png

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

I've never seen an option for SGPLOT that does what you describe, but you can suppress the ticks with display=(noticks) and you can draw a grid inside the plot area, like this

 

proc sgplot data=sashelp.class;
scatter x=height y=weight;
xaxis display=(noticks nolabel novalues) grid;
yaxis display=(noticks nolabel novalues) grid;
run;
Jay54
Meteorite | Level 14

Rick is correct that SGPLOT does not expose such an option.  However, GTL supports TICKSTYLE=Outside | Inside | Across.  If necessary, you could export the GTL from the SGPLOT procedure (use tmplout option) and then add this option to the xaxisopts option bundle.

 

proc template;
  define statgraph class;
  begingraph;
    layout overlay / xaxisopts=(tickstyle=inside);
      scatterplot x=height y=weight;
    endlayout;
  endgraph;
end;
run;

 

proc sgrender data=sashelp.class template=class;
run;

 

Spider1.png

Alain38
Quartz | Level 8

I will try this solution, thank you Smiley Happy

 

Edit: Tested and approved!

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1963 views
  • 4 likes
  • 3 in conversation