BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mich_ard
Fluorite | Level 6

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

7 REPLIES 7
Reeza
Super User

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

 

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

 

Shmuel
Garnet | Level 18

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

ballardw
Super User

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.

mich_ard
Fluorite | Level 6

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

mich_ard
Fluorite | Level 6

Thank 

 

 

 

 

 

 


shoes sale.jpg
Reeza
Super User

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. 

mich_ard
Fluorite | Level 6

thanks master, you solved my problem. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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