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

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 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20
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;

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20
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;
LoPez_Diaz
Obsidian | Level 7

Thank you very much , That works great !

PeterClemmensen
Tourmaline | Level 20

Anytime, glad to help 🙂

SAS Innovate 2025: Register Now

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 822 views
  • 2 likes
  • 2 in conversation