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
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.