08-12-2015 05:26 AM
I am looking to convert a table like the one below...
into the following table. So, turn the count into a running total for each section.
08-12-2015 05:37 AM
Can you provide some test data in the form of a datastep, as your data is before. I don't see why you only have number at certain points. I mean you could do retain, however, why do you only have some numbers, it may be easier to change the way count is added to the dataset rather than retain them afterwards.
08-12-2015 06:21 AM
data want (drop=oldcount);
set have (rename=(count=oldcount));
if first.section then count = 0;
if oldcount ne . then count=oldcount;
Edit: Replaced zero with dot in second if condition
Post updated: Kurt Bremser
08-12-2015 06:33 AM
Yes, but it still begs the question, what is the count column, how is it arrived at, i.e. why does Q1 have 1 and Q2 not? Also, you can't have a Q5.
08-12-2015 07:42 AM
Looks like a common LOCF problem to me.