Hello ,
So I have this data output that have the following format :
DATE | MATURITY | RATE
25/04/19 3 2.164
25/04/19 4 2.184
22/04/19 7 3.015
19/04/19 5 2.715
. . .
. . .
The data changes daily , and I need to refresh this on a daily basis.
For every date , we may have multiple maturities traded with a specific RATE .
for my output table , I need it to have a column for dates , and different columns for every maturity ( Maturity can be from 1 to 11 , so I should have 11 more columns) .
My output table should look Something like this
DATE | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
25/04/19 2.164 2.184
22/04/19 3.015
19/04/19 2.715
Thank you in advance for your responses , I'm new to sas and I'm figuring out my way through , so I appologise for message format
data have;
input DATE:ddmmyy10. MATURITY RATE;
format DATE ddmmyy10.;
datalines;
25/04/19 3 2.164
25/04/19 4 2.184
22/04/19 7 3.015
19/04/19 5 2.715
;
proc sort data=have;
by descending date;
run;
data want(keep=date _:);
length date 8;
array _{11};
do until (last.date);
set have;
by descending date;
_{MATURITY}=RATE;
end;
run;
data have;
input DATE:ddmmyy10. MATURITY RATE;
format DATE ddmmyy10.;
datalines;
25/04/19 3 2.164
25/04/19 4 2.184
22/04/19 7 3.015
19/04/19 5 2.715
;
proc sort data=have;
by descending date;
run;
data want(keep=date _:);
length date 8;
array _{11};
do until (last.date);
set have;
by descending date;
_{MATURITY}=RATE;
end;
run;
Thank you very much , That works great !
Anytime, glad to help 🙂
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.