Say I have a table of two columns of Dates and VINs, and I want to implement conditional nested loops to create a counter. The condition would essentially count the number of observations of unique VINs within a series of unique dates. DATES VINS 1880 4V6HJ 1880 4V6HJ 1880 6C8KI 1881 4V6HJ 1884 6C8KI For example, the above table would give a counter value of 4 because there are 2 distinct VINs within a distinct date and 2 distinct VINs in separate unique dates. I know how to generally implement this code in other languages, but I'm unaware of how to do this in SAS program within an EG project given varying indexing syntax and condition. I suppose I would generally write it like this; it would be nice to see this generalized into SAS program. i=1; n=0; for 1:(length of column)-1 if date(i) = date(i+1) if vin(i) ~= vin(i+1) n = n+1; end else if date(i) ~= date(i+1) n=n+1; end i = i+1; end
... View more