BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.

dear all

i have the data on interest rates in weekly frequency. 

i would like to convert it into daily frequency by repeating the same rates throughout the week.

please suggest a SAS code to perform this function 

my data is in the following format 

date interest_rate
30-Jun-20213.8898
07-Jul-20213.8419
14-Jul-20213.8099
20-Jul-20213.7744
28-Jul-20213.7299

 

i want output in the following format 

date interest_rate
30-Jun-20213.8898
01-Jul-20213.8898
02-Jul-20213.8898
03-Jul-20213.8898
04-Jul-20213.8898
05-Jul-20213.8898
06-Jul-20213.8898
07-Jul-20213.8419
08-Jul-20213.8419
09-Jul-20213.8419
10-Jul-20213.8419
11-Jul-20213.8419
12-Jul-20213.8419
13-Jul-20213.8419
14-Jul-20213.8099
15-Jul-20213.8099
16-Jul-20213.8099
17-Jul-20213.8099
18-Jul-20213.8099
19-Jul-20213.8099
20-Jul-20213.7744
21-Jul-20213.7744
22-Jul-20213.7744
23-Jul-20213.7744
24-Jul-20213.7744
25-Jul-20213.7744
26-Jul-20213.7744
27-Jul-20213.7744
28-Jul-20213.7299
29-Jul-20213.7299
30-Jul-20213.7299
31-Jul-20213.7299
01-Aug-20213.7299
02-Aug-20213.7299
03-Aug-20213.7299

 

 

thanking in advance 

 

 

 

1 ACCEPTED SOLUTION
2 REPLIES 2
Ksharp
Super User
data have;
infile cards expandtabs;
input date  : date11. interest_rate;
format date date11.;
cards;
30-Jun-2021 	3.8898
07-Jul-2021	 3.8419
14-Jul-2021	 3.8099
20-Jul-2021	 3.7744
28-Jul-2021	 3.7299
;

data want;
merge have have(firstobs=2 keep=date rename=(date=_date));
output;
do date=date+1 to ifn(_date-1=.,date+6,_date-1);
 output;
end;
drop _date;
run;

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
  • 2 replies
  • 512 views
  • 1 like
  • 3 in conversation