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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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