I *simply* want to fill in the missing values for M_mg in a check book balancing type of process, subtracting Md_mg each time; in other words for observation 2 M_mg should equal 8.78888, for observation 3 it should equal 8.78584, and so on. Resetting at the change variable 0 (0 is first.).
I've tried various combinations of the retain statement, first., etc. and appear to be stuck. Help appreciated! Thank you. NWV
I use your suggestion and ended up doing something similar, although I did use the first. instead of if change=0.
I have another variable sampletype that uniquely codes the groups, so with first.sampletype=m_mg0 (now called T0_mass), I then retained the m_mg and subtracted md_mg--the code looked like this and produced the needed result:
by sample change;
if first.sample then M_mg=T0_mass;
proc print data=d4;run;
Thank you again for the clue the provided my solution.