Say I want to estimate the prevalence of something across multiple weeks, and then also create an "upper" and "lower" bound where I add and subtract the SE to that average. I have the starts of two solutions but neither one is complete.

Option 1: collapse

Code:
collapse(mean) mean_score = score, by(week)
This gets me the mean test score, but not an SE.

Option 2: margins
Code:
eststo margin: margins, over(week) post
And then somehow extract the -Margin- and SE, but not output them using -estout- (or your package of choice), I'd want to keep it in Stata and then add and subtract the SE to create new upper and lower bound variables, and then export the margin, lower, and upper variables.

Or perhaps there's some entirely easier way to do all this.

Does this make any sense? Any thoughts on the most efficient way to do this?