Your original post started out as a lie:
I was able to get the frequency on 2 variables age and score and plot an histograms for both using the following formulas.
Both of the steps you posted contain an error. Neither will work. Maybe you got something to work, but it's not the code that you posted.
What does this say about you? I don't know. But I know it plays a role in why you got very little response to your question. For a macro to work, the code within it has to work. Once you wrap the code inside a macro, it becomes much more difficult to debug. So I wouldn't waste my time putting a macro around it when I know the macro has to fail. Rightly or wrongly, I am imagining that I would have to solve 3 or 4 questions instead of 1 ... how to write a macro, how to correct errors that result, and likely how to add functionality that is not included in your simplified program.
If you get your part right, there are dozens of posters who could easily answer your question.
... View more