BookmarkSubscribeRSS Feed
sas_learner_NEW
Fluorite | Level 6

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;

 

 

 

3 REPLIES 3
PeterClemmensen
Super User

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.

Kurt_Bremser
Super User

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;
sas_learner_NEW
Fluorite | Level 6

thanks

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 241 views
  • 0 likes
  • 3 in conversation