I think this is a simple dilemma but it has caused me many hours of frustration. I am new to the STATA game (and to statistics in general), but I have a big project I have to figure out for myself.

I have a variable for the date and one for the corresponding value of each date. Lots of dates are omitted (for when the corresponding value is 0). However, the dates span sixty years, and I want to find the mean of the corresponding values for each year. I cannot figure out how to do this. Also, I need to find the mean of the corresponding value for a different variable (a nominal one with five values). This nominal variable denotes each Chief Justice of the Supreme Court, and I need to know how many of the "corresponding values" each Chief averages per year. I am so lost.

Any guidance would be greatly appreciated. thanks!