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

Hi all,

 

I am after some assistance.

 

I have a dataset that I want to fill the white gaps within the data set.

 

Variables - Date, Index, Month, Year, Name, ID, ID_Name, Value.

 

Date is just month/year where Month & Year are just functions of the Date Variable.

 

Index represents a block range of dates that is repeated every time the index is incremented. I require the white space within the blocks of dates to be repeated. The only issue is if there is a change in value within the block range of dates.

 

Any help would be greatly appreciated.

 

For example...

 

 

Have:       
DateIndexMonthYearNameIDID_NameValue
Jan-03112003 . .
Feb-03122003 . .
Mar-03132003 . .
Apr-03142003John45Teacher101
May-03152003 . .
       
Jan-03212003 . .
Feb-03222003Bill98Engineer76
Mar-03232003Bill98Engineer80
Apr-03242003 . .
        
        
Want:       
DateIndexMonthYearNameIDID_NameValue
Jan-03112003John45Teacher101
Feb-03122003John45Teacher101
Mar-03132003John45Teacher101
Apr-03142003John45Teacher101
May-03152003John45Teacher101
       
Jan-03212003Bill98Engineer76
Feb-03222003Bill98Engineer76
Mar-03232003Bill98Engineer80
Apr-03242003Bill98Engineer80

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Go210
Obsidian | Level 7

All Solved.

 

Just modified to capture the obs above.

 

data want;
do until(not missing(value) or last.index);
  set have;
  by index; 
end;
temp=value;
do until(not missing(value) or last.index);
  set have;
  by index;
  _value=temp;output;
end;
drop temp value;
run;

View solution in original post

2 REPLIES 2
Go210
Obsidian | Level 7

 

I can fill some of the gaps. But need to fill in the previous too.

 

data want; update have (obs=0) have; by index; output; run;

Go210
Obsidian | Level 7

All Solved.

 

Just modified to capture the obs above.

 

data want;
do until(not missing(value) or last.index);
  set have;
  by index; 
end;
temp=value;
do until(not missing(value) or last.index);
  set have;
  by index;
  _value=temp;output;
end;
drop temp value;
run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 1874 views
  • 0 likes
  • 1 in conversation