SAS dates showing up as scientific notation on line graph

Reply
Occasional Contributor
Posts: 8

SAS dates showing up as scientific notation on line graph

I've been creating some graphs from data in a SAS library. The column type that I am using form my X axis is of the type "Date".

When the graph is build, it displays the time in a scientific notation format. How do i format the X axis labels to appear as readable dates? (e.g. Apr 01,2012)

sasgraph2.jpgsasgraph.jpg

Contributor
Posts: 23

Re: SAS dates showing up as scientific notation on line graph

Do you have any code for this that you can send, or are you working strictly in Enterprise Guide? The easiest way to fix this would be to add a FORMAT statement to the code, but there are a couple of things you would have to do first. The variable MARKETDATE is stored as a SAS datetime value (seconds since 1/1/1960), which means that to get the correct value you would need to create another variable to get the SAS date (DAYS since 1/1/1960) from that.

marketday = DATEPART(marketdate);

Next, the easiest way to get those dates on your X axis is to add a FORMAT statement for that new variable you created to the PROC GPLOT.

FORMAT marketday date9.;

This will display the dates in the form "01FEB2012" as an example, but you have many more choices available to you. For a list of SAS date formats, look at the documentation.

Derek

Occasional Contributor
Posts: 8

Re: SAS dates showing up as scientific notation on line graph

Posted in reply to cov_derek

Thanks for the quick reply. Here is the code I am currently running. (I'm VERY new to SAS)

Attachment
Super User
Posts: 11,343

Re: SAS dates showing up as scientific notation on line graph

You may not need a new variable. Use the DTDATE format to show just the date part of a datetime variable.

Try adding

Format tyme dtdate7.; to your GPLOT code

Contributor
Posts: 23

Re: SAS dates showing up as scientific notation on line graph

Now THAT  is the easiest solution.

 

PROC GPLOT DATA = SHARED.SORTTempTableSorted

;

PLOT (RTLMP DALMP)* tyme / OVERLAY

VAXIS=AXIS1

HAXIS=AXIS2

FRAME;

FORMAT tyme DTDATE9.;

/* -------------------------------------------------------------------

End of task code.

------------------------------------------------------------------- */

RUN; QUIT;

If your dates don't quite display the way you want them, you may need to mess with your AXIS statements. Come back to this thread if you still have problems.

Derek

Derek

Occasional Contributor
Posts: 8

Re: SAS dates showing up as scientific notation on line graph

I had high hopes for that one, but alas I am foiled at each turn. The format of the "tyme" still displays in Sci Note. Smiley Sad

i'll try the first recommendation to see if i can get that to work.

Thanks,

Tom

Ask a Question
Discussion stats
  • 5 replies
  • 655 views
  • 1 like
  • 3 in conversation