Thanks to everyone. What I ended up doing:
/* Create labels based on data */
proc sql noprint;
select
put (datepart(min(date)), nldate.),
put (datepart(min(date)), yymmdd10.),
intnx ("dtday", min(date), 0, "B") format=15.,
put (datepart(min(date)) + 1, yymmdd10.),
intnx ("dtday", min(date), 1, "B") format=15.
into
:titledate trimmed,
:datelabel1 trimmed,
:dateref1 trimmed,
:datelabel2 trimmed,
:dateref2 trimmed
from demande;
quit;
title "Hydro-Québec";
title2 "Production, depuis le &titledate.";
proc sgplot data=demande;
series x=date y=demandeGW / lineattrs=(thickness=2);
xaxis type=time display=(nolabel) offsetmin=0.05 offsetmax=0.05 valuesformat=tod2. ;
yaxis offsetmin=0.05 offsetmax=0.05;
refline &dateref1. &dateref2. /
axis=x lineattrs=(pattern=dot) labelloc=inside labelpos=min
label=("&datelabel1." "&datelabel2.") labelattrs=(size=8);
refline 20 to 40 by 1 / axis=y;
run;
I won't mark my own answer as a solution, since it is close but not quite what I wanted, i.e. automatic tick labels on two lines outside the data frame without the ":00:00".
Btw the INTERVAL=HOUR option created full date:hour tick labels on a single line.
... View more