Dear community, As a beginner in this community I would request a help. is the code for the question
" What is the mean value of the Sales variable for observations in the “Middle” group? Round
your answer to the nearest whole number. " correct or please suggest any modification.
proc means data= work.shoesrange nolabels mean;
class salesrange;
run;
I can't see your data, so I can only guess that the "Middle" group is in the salesrange variables.
In that case, yes, your code is fine and will give you the mean value for the "Middle" group in the Results Viewer.
You could specify the MAXDEC Option in the Proc Means Statement to specify the desired number of decimals.
Since you only want one group, you should restrict the observations to that group.
You also want only one variable averaged, so you should tell the procedure that.
proc means data=shoesrange nolabels mean;
where salesrange = "Middle"; /* if "Middle" is in fact the result of a custom format applied to salesrange, this must be adapted */
var sales;
run;
Alternatively, you can use SQL:
proc sql;
select avg(sales) as average_sales
from shoesrange
where salesrange = "Middle";
quit;
thanks
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.