comparison of a sample to another sample described by a histogram I want to compare two groups -- a population and my sample. I need to find out if the sample is a representative sample of the population. Normally, I would use the Welch t-test to find out if the mean age in each group is the same. In my case, I do not have primary data for the population, I only have a histogram, i.e. frequencies in age groups (20-29y, 30-39y…90-99y). How can I compare these two groups? What test can I use?

On the one hand, you state that you need to find out "if the sample is a representative sample of the population", and on the other hand, you state that you want to "find out if the mean age in each group is the same". Note, that this is not the same.
Presuming that it suffices to determine that the means are the same, Welch's t-test is appropriate for two samples, provided the pertinent conditions are approximately satisfied, so you might want to do some normality test first.
But in your case, you don't have a reference sample but a histogram, so I would just suggest computing the mean of the histogram and then doing a simple t-test, again provided the necessary conditions are met.
You could compute the mean of the histogram by taking the weighted mean of the centers of your histogram bins, where the weights are given by the values of the histogram.
