09-08-2012 01:31 PM
I'm new to sas and having a hard time finding the monthly variance in the daily data set I have attached here ( i have deleted some part of the data to make the file smaller).
I want to plot monthly variance of this daily data from 2000 to 2010 so that I can see if there's a pattern.
Please be kind enough to help me with this coding.
PS. Im using SAS 9.0
09-08-2012 02:03 PM
Hi ... you posted data in a PDF file ... hard to use. How about posting a data set or text or XLS (something that is easily used). Also, the PDF has lost of columns but no variable names. The first column is date, but what column do you want analyzed (variance computation).
Here's an example using a data set from the SASHELP library (n case V9 does not have the TIMEDATA data set, it's attached) ...
* use a SASHELP data set ... extract date from variable DATETIME;
data test (keep=date volume);
date = datepart(datetime);
* calculate monthly variance for variable VOLUME;
proc summary data=test nway;
output out=month_var var=;
format date monyy.;
* set graphics options;
goptions reset=all ftext='calibri' htext=2 gunit=pct;
* choose a symbol ... use a spline to fit to the monthly data;
symbol f='wingdings' v='6c'x i=smp66 c=blue h=2 w=2;
axis1 minor=none label=("MONTH-YEAR");
axis2 label=(a=90 'VOLUME');
title1 h=4 'MONTHLY VARIANCE OF VOLUME' ls=2;
* add white s[ace around plot;
title2 a=90 ls=2;
title3 a=-90 ls=2;
* plot the values;
proc gplot data=month_var;
plot volume*date / haxis=axis1 vaxis=axis2 noframe;
format volume comma7.;
09-08-2012 02:11 PM
Hi thank you very much.
I am sorry I couldn't mention the column titles. They are: date, open, high, low, close, volume, adjclose, return.
I need the variance to be calculated for every month for every year, so I could see the pattern.
However, when I tried to attach the excel file it didn't let me...if you send me your email address I can send it to you...
I really appreciate you help.