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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.