BookmarkSubscribeRSS Feed
lchristensen
Obsidian | Level 7

SS V9.4 on Windows Server

 

My data includes a date/time field (CurrentTime) and an interval of time in minutes (CTDelta_Time_In_Minutes). The SGPLOT should have the CurrentTime value on the x-axis and the CTDelta_Time_In_Minutes on the y-axis....and it doesn't.

 

The CurrentTime value is date/time including seconds. There may be as many as 12 records for every hour. The input dataset could contain weeks, maybe even months, of data.

 

The problem is the legend is unintelligible. I think it's trying to list every value on the chart and that could be thousands. 

 

What I'd like is to have something like every hour as a marker. Can you offer advice?

 

SAS code is attached. Also a PDF of the plot is attached as a PDF.

 

 

Code:

filename URMETRCS 'z:\Mainframe\lchristensen\URMETRCS\URMETRCS_RPT.csv';
title;
proc import datafile="URMETRCS" out=Work.Report_CSV dbms=csv;
run;
Data Work.URMETRCS_EVENTLOG Work.CTDelta_Time;
infile URMETRCS end=eof length=reclen missover;
data Work.Read_CSV;
set Work.Report_CSV;
format CTDelta_Minutes 6.0;
CTDelta_Minutes = (CTDelta_Secs / 60); /* convert CTDelta_Secs to minutes */
run;
proc print data=Work.Read_CSV noobs uniform;
title "Word.Read_CSV";
run;
proc sort data=Work.Read_CSV nodupkey;
by CurrentTime;
run;
ods pdf;
proc sgplot data=Work.Read_CSV; /* graph with date/time on bottom and CTDelta_Time on y axis */
series x = CurrentTime y = CTDelta_Minutes ;
/* xaxis type = discrete; */
title1 "Hitachi Mainframe Replication Extenstion";
title2 "CTDelta Time in Minutes by Date/Time";
run;
ods pdf close;
quit;

2 REPLIES 2
djrisks
Barite | Level 11

@lchristensen , can you use the XAXIS option fitpolicy = thin, to only show some tick values? Alternatively can you use the VALUES option to only select some time values to display?

 

Thanks,


Kriss 

GraphGuy
Meteorite | Level 14

One clarification on the terminology - I think you mean the X-axis, rather than the Legend(?)

 

Since I don't have your data, I can't say for certain - but I suspect that the value you're plotting on the x-axis is character, rather than a numeric/datetime value. Convert those character values to numeric/datetime values, and then SAS won't feel compelled to show every x-value on the axis. 🙂

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 683 views
  • 1 like
  • 3 in conversation