Hi
"The combination between Timeseries1 and Timerseries2 is in my case the same as the pair between Timeseries2 and Timeseries1"
Think I understand. So it would be "n(n-1)/2".
I added a abs() function around the log() so that it won't matter which way round the pair is constructed.
Let me know if I got it right this time.
data have;
format date date9.;
do TimeSeriesID=1 to 3;
do date='01Mar2010'd to '02Mar2010'd;
id+1;
value=floor(ranuni(1)*10);
output;
end;
end;
run;
proc sql;
select
l.id as l_id,r.id as r_id,
abs(log(l.Value/r.Value)) as y
,l.value as l_value, r.value as r_value
,l.TimeSeriesID as L_TimeSeriesID
,r.TimeSeriesID as R_TimeSeriesID
,l.date as l_date,r.date as r_date
from have as l,have as r
where l.id < r.id
;
quit;
"In order to not make the data set huge, I thought of storing all the time series in one data set with many columns"
It's in the end the number of datapoints which counts and defines the storage requirements. If you organise them in a few rows but many columns or in many rows and only a few columns has not that much of an effect.
I would suggest that you organise your data in a way which suits your needs best.
HTH
Patrick