*
; /* Subject: Plotting datetime format with truncated axis values. Summary: User formats are easy. Respondent: Ian Whitlock;Rob has a problem with a datetime variable in a PROC GPLOT. >I am having difficulty in creating an axis which can be used in a gplot >where the time variable to be plotted is in DATETIME 19.2 format. >Because I am typically plotting a month worth of data, the DATETIMEw.d >format is not so useful as it has a minimum length of 7 and the values become >very >cluttered. I could rotate the values with >... value=angle=90 ............... > but this gives me less space for graphing the values. >I must retain the datetime value as there are multiple observations over >different hours of the day and if I were to convert them do date variables >the fine detail of hours etc would be lost. >Ideally , the axis would look something like this although the month/year >could >be put elsewhere in a footnote/title/annotate etc. > > | > | > | > |__________________________________ _ _ _ _ > 01 02 03 04 05 ................. 31 > JANUARY 1996 > >Maybe I am looking at this from the wrong way and should be concentrating on >creating a format which would allow me to specify something like: > > /*Note: macro vars strtdt, enddt, mth already assigned.*/ > axis1 order=("&STRTDT.:00:00"dt to "&ENDDT.:23:59"dt by dtday) > label="&MTH"; > > proc gplot data=uuvmst; > plot usrcpu*datetime=1 / > haxis=axis1 > format datetime MYFMT. ; As he suggests one simple way to attack the problem is make a format showing just the day for datetime values. Here is a simple macro to make the format. Ian whitlock */ %macro dtday ( start = 01feb96 ) ; data fmtdata ( keep = fmtname start end label ) ; retain fmtname 'dtday' start "&start:00:00:00"dt ; do day = 1 to 31 while (datepart(start) < intnx('month',"&start"d,1)) ; end = start + 86399 ; label = put ( day , 2. ) ; output fmtdata ; start = end + 1 ; end ; run ; proc format cntlin = fmtdata ; run ; %mend dtday ; *