SAS/ETS Examples
Accounting for Missing Observations in Time Series Data
Contents |
Back to Example
/*-----------------------------------------------------------------
Example: Accounting for Missing Observations in Time Series Data
Requires: SAS/ETS, SAS/GRAPH
Version: 9.0
------------------------------------------------------------------*/
ods trace on;
data cash;
input date : monyy. balance @@;
label balance = "Cash Account Balance";
format date monyy.;
datalines;
aug95 84 sep95 52 oct95 8 dec95 98 jan96 61 feb96 24 may96 67 jun96 58
aug96 43 sep96 3 oct96 73 nov96 90 dec96 89 jan97 55 feb97 86 mar97 79
apr97 23
;
proc print data=cash;
title 'Cash Account Balances - Original Data';
run;
proc expand data=cash out=cash2 to=month method=none;
id date;
run;
proc print data=cash2;
title 'Cash Account Balances - Expanded Data';
run;
data graph;
set cash2;
if balance=. then unknown=98;
run;
proc gplot data=graph;
plot balance*date unknown*date / overlay vaxis=axis2
href='01nov95'd
href='01mar96'd
href='01apr96'd
href='01jul96'd
chref=red lhref=2
cframe=ligr;
title1 "Plot of Cash Balance at Beginning of Month" h=3;
axis2 label=(angle=90 'Cash Account Balance');
symbol1 c=blue interpol=join value=star;
symbol2 c=black interpol=none font=complex h=7 value="?";
run;
quit;