Help using Base SAS procedures

Proc Means

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,041
Accepted Solution

Proc Means

Hi Team,

When i run this code I get a WARNING!!!!!

Could you explain please where I went wrong???

Thanks

proc means data=grafts nway noprint;

var age;

output out=mean_grafts n= mean= std= median= min= max=;

run;

WARNING: Variable AGE already exists on file WORK.MEAN_GRAFTS.


WARNING: Variable AGE already exists on file WORK.MEAN_GRAFTS.


WARNING: Variable AGE already exists on file WORK.MEAN_GRAFTS.


WARNING: Variable AGE already exists on file WORK.MEAN_GRAFTS.


WARNING: Variable AGE already exists on file WORK.MEAN_GRAFTS.


WARNING: The duplicate variables will not be included in the output data set of the output


         statement number 1.


Accepted Solutions
Solution
‎10-01-2012 02:05 PM
Trusted Advisor
Posts: 1,932

Re: Proc Means

Posted in reply to robertrao

YOur output statement is trying to assign the variable name AGE to the results of N=, and then it is trying to assign the variable name AGE to the results of MEAN=, and so on. Can't be done. You can't have multiple variables named AGE.

You need to give each of the statistics that you request in your OUTPUT statement a distinct name, or use the /autoname option.

View solution in original post


All Replies
Solution
‎10-01-2012 02:05 PM
Trusted Advisor
Posts: 1,932

Re: Proc Means

Posted in reply to robertrao

YOur output statement is trying to assign the variable name AGE to the results of N=, and then it is trying to assign the variable name AGE to the results of MEAN=, and so on. Can't be done. You can't have multiple variables named AGE.

You need to give each of the statistics that you request in your OUTPUT statement a distinct name, or use the /autoname option.

Super Contributor
Posts: 1,041

Re: Proc Means

Posted in reply to PaigeMiller

OOPs. I used autoname this time and it worked out.

Thanks

Paige

proc means data=grafts nway noprint;

var age;

output out=mean_grafts n= mean= std= median= min= max=/autoname;

run;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 231 views
  • 1 like
  • 2 in conversation