I have a data set with lets say 2 variables A & B (in actual fact there are around 70 variables but these are the only two I am interested in) A, B, 1, a, 1, b, 1, c, 1, c 2, d 2, d 2, d 2, b 2, b 3, a 3, c 3, b 3, b 3, d I only want to output observations for each A value up until the B value equals B. So from first.A until B no longer = 'b', and this is repeated for each A value. I'm trying to use a do while loop but it doesn't seem to be working. So in this example it would keep the first two observations where A = 1 the first 5 observations where A = 2 and the first 4 observations where A = 3. The values of B before B = 'b' are not always the same and can be made up of any combination of values except 'b' Any Ideas?
... View more