Hi, I am trying to find mean by group of my data. I have one indicator variable (named CR) taking value of either 0 or 1. I have another variable of deciles (named decile) taking value from 0 to 9. I am trying to find out the mean of CR within each decile. I did the following:
proc means data= DATA. CR mean;
var CR;
by decile;
run;
quit;
Can you please let me know what am I doing wrong since I am not getting the desired output?
Thank you.
The main thing you're doing wrong is not reading the log to see what messages SAS is giving you. Nobody here can figure that out, so it would be a good idea to post the log.
Here's a small list of relevant items to consider:
Looks like the code should work. What is wrong with the results? Please be very specific and show us the results so we can see what you are seeing.
Thank you for the reply. I was able to solve the issue by sorting the deciles in ascending order.
The main thing you're doing wrong is not reading the log to see what messages SAS is giving you. Nobody here can figure that out, so it would be a good idea to post the log.
Here's a small list of relevant items to consider:
@sanrim hi and welcome to the SAS Community 🙂
Can you post some sample of your data and what you want the desired result to look like? Makes it much easier for you to demonstrate what you mean and much easier for us to provide a usable code answer.
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.