BookmarkSubscribeRSS Feed
malakaext
Calcite | Level 5

Hi,

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.

thanks.

PS. Im using SAS 9.0

Malaka

6 REPLIES 6
MikeZdeb
Rhodochrosite | Level 12

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);

set sashelp.timedata;

date = datepart(datetime);

run;

* calculate monthly variance for variable VOLUME;

proc summary data=test nway;

class date;

var volume;

output out=month_var var=;

format date monyy.;

run;

* 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;

footnote1 ls=1;

* plot the values;

proc gplot data=month_var;

plot volume*date / haxis=axis1 vaxis=axis2 noframe;

format volume comma7.;

run;

quit;


month_var.png
malakaext
Calcite | Level 5

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.

Malaka

MikeZdeb
Rhodochrosite | Level 12

Hi ... did you try first converting the XLS file to a ZIP file then attaching.  Give that a try.

malakaext
Calcite | Level 5

Hi

Here's the data..

Thanks

MikeZdeb
Rhodochrosite | Level 12

Hi ... I posted an answer in the other THREAD that you started.  Let me know if you find it and if it works for you.

malakaext
Calcite | Level 5

Hi..

I attached the data set in a new discussion titled 'Help wit SAS code' can you please help me write this code..

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1640 views
  • 4 likes
  • 2 in conversation