DATA Step, Macro, Functions and more

A question about using "output out="

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

A question about using "output out="

Hi

I got a problem when I practise using  "output out=" . The dataset I'm using is sashelp.shoes, which is about shoes sale in the world, and contains many different regions (africa, asia,europe ...). I want to make a table which can summerize the sales based on regions (africa, asia,europe ...), this is my codes:

 

proc means data= sashelp.shoes ;
var total sales ;

by region;
output out=Regional_sales SUM(total sales)=reginal_sales;

run;

 

but it didn't work, the log says: 


ERROR: Variable TOTAL not found.

why ?

 

thanks.

 


Accepted Solutions
Solution
‎08-17-2016 05:43 PM
Super User
Posts: 17,868

Re: A question about using "output out="

Your mixing up a variable label and the variable name. Total sales is the variable label.  

Proc contents will show the label and name.

 

Labels are used to control a variable display name in reports and such, names are used in coding and have more restrictions. 

View solution in original post


All Replies
Super User
Posts: 17,868

Re: A question about using "output out="

Because there's no variable called Total in SASHELP.SHOES.

 

Run a proc contents on your dataset to see the variable names.

 

Trusted Advisor
Posts: 1,392

Re: A question about using "output out="

There is no variable named "Total" in sashelp.shoes.

 

I should change in your program:

 

var sales;

output out=Regional_sales SUM(sales)=total_regional_sales;

 

Shmuel

Super User
Posts: 10,516

Re: A question about using "output out="

If you only want the output data set you might consider using Proc Summary or use the NOPRINT option with Proc Means to suppress the display tables.

Occasional Contributor
Posts: 11

Re: A question about using "output out="

yes, i tried it, works just like proc means(+noprint). thanks a lot.

Occasional Contributor
Posts: 11

Re: A question about using "output out="

Thank 

 

 

 

 

 

 


shoes sale.jpg
Solution
‎08-17-2016 05:43 PM
Super User
Posts: 17,868

Re: A question about using "output out="

Your mixing up a variable label and the variable name. Total sales is the variable label.  

Proc contents will show the label and name.

 

Labels are used to control a variable display name in reports and such, names are used in coding and have more restrictions. 

Occasional Contributor
Posts: 11

Re: A question about using "output out="

thanks master, you solved my problem. 

☑ This topic is SOLVED.

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

Discussion stats
  • 7 replies
  • 290 views
  • 0 likes
  • 4 in conversation