I imported my .xlsx file into SAS and have no problem calculating the mean for the entire sheet using the below code:
PROC MEANS DATA=WORK.MYDATA;
run;
But what code do I add if I want to calculate the mean just for a specified range of cells (e.g. A2-A50)? I'm working with version 9.2.
List your variable names in the var statement in proc means
PROC MEANS DATA=WORK.MYDATA mean;
var A2--A50;
run;
I don't have any variables actually named "A2" or "A50." I meant the cells A2, A3, A4, etc. within an Excel spreadsheet. Any advice on this?
run a proc contents on your imported dataset
like
PROC contents DATA=WORK.MYDATA;
run;
Then you should be able to get the name of the variables to list in the var statement
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.