BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Camilla
Fluorite | Level 6

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.

DateSamsungElecKEPCOHyundaiMtr
2004-06-171.381.094.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-212.412.450.49

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Camilla
Fluorite | Level 6

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;

 

View solution in original post

6 REPLIES 6
Reeza
Super User

If you transpose your data so that its long instead of wide you can add a BY statement to your PROC EXPAND. 

You can do this via PROC TRANSPOSE. 

 

This will probably be useful later on as well. 

Camilla
Fluorite | Level 6
Thank you!
udo_sas
SAS Employee

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

 

 

 

Camilla
Fluorite | Level 6
Thank you!
Camilla
Fluorite | Level 6

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;

 

Reeza
Super User

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

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