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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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