Fluorite | Level 6

## From daily to monthly

Hello! Could you help me with the following?

I have time series data with 255 variables.

I have to convert all 255 companies' rate of return daily data  to monthly data from 2004 to 2016. I have done it with one variable using proc expand

proc expand data=work.risk

from=day to=month

out=avmonthly;

id Date;

Convert Rf/

observed =average;

run;

But how can I use this to matrix data with 255 variables. The data looks like this. There are only 3 companies shown. I have to use the program to 255 companies.

 Date SamsungElec KEPCO HyundaiMtr 2004-06-17 1.38 1.09 4.50 2004-06-18 -1.47 -1.08 -2.63 2004-06-19 -1.47 -1.08 -2.63 2004-06-20 -1.47 -1.08 -2.63 2004-06-21 2.41 2.45 0.49

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Fluorite | Level 6

## Re: From daily to monthly

Thank you for your responses. I tried the other way and it worked:

proc expand data=work.risk

from=day to=month

out=avmonthly;

id Date;

Convert SamsungElec--Hyundai Mtr/

observed =average;/

run;

6 REPLIES 6
Super User

## Re: From daily to monthly

You can do this via PROC TRANSPOSE.

This will probably be useful later on as well.

Fluorite | Level 6

Thank you!
SAS Employee

## Re: From daily to monthly

Hello -

You may want to consider using PROC TIMESERIES instead.

For example:

proc timeseries data=work.risk out=work.want;

id date interval=month accumulate=mean;

var _numeric_;

run;

Thanks,
Udo

Fluorite | Level 6

## Re: From daily to monthly

Thank you!
Fluorite | Level 6

## Re: From daily to monthly

Thank you for your responses. I tried the other way and it worked:

proc expand data=work.risk

from=day to=month

out=avmonthly;

id Date;

Convert SamsungElec--Hyundai Mtr/

observed =average;/

run;

Super User

## Re: From daily to monthly

I didn't know you could list variables like that. Cool!

Discussion stats
• 6 replies
• 2235 views
• 1 like
• 3 in conversation