BookmarkSubscribeRSS Feed
eduar78
Calcite | Level 5
The code

PROC SGPLOT DATA=salesByProductByDate(WHERE=(year = 2015));
VBAR product / RESPONSE=sales GROUP=month GROUPDISPLAY=cluster
STAT=sum DATASKIN=gloss;
XAXIS DISPLAY=(nolabel noticks);
YAXIS GRID;
RUN;

And the error from above code

TITLE '2015 Sales By Product';
 96         PROC SGPLOT DATA=salesByProductByDate(WHERE=(year = 2015));
 97         VBAR product / RESPONSE=sales GROUP=month GROUPDISPLAY=cluster
 ERROR: Variable PRODUCT not found.
 ERROR: Variable SALES not found.

2 REPLIES 2
PaigeMiller
Diamond | Level 26

I think the error messages are clear. The variables PRODUCT and SALES are not in the data set SALESBYPRODUCTBYDATE.

 

You need to actually look at the data set with your own eyes to see what the problem is. You can use PROC PRINT or VIEWTABLE or even PROC CONTENTS.

--
Paige Miller
ballardw
Super User

@eduar78 wrote:
The code

PROC SGPLOT DATA=salesByProductByDate(WHERE=(year = 2015));
VBAR product / RESPONSE=sales GROUP=month GROUPDISPLAY=cluster
STAT=sum DATASKIN=gloss;
XAXIS DISPLAY=(nolabel noticks);
YAXIS GRID;
RUN;

And the error from above code

TITLE '2015 Sales By Product';
 96         PROC SGPLOT DATA=salesByProductByDate(WHERE=(year = 2015));
 97         VBAR product / RESPONSE=sales GROUP=month GROUPDISPLAY=cluster
 ERROR: Variable PRODUCT not found.
 ERROR: Variable SALES not found.


This type of error sometimes comes from thinking that you want information about "product" but forget that the actual variable name is something like "product_number" "product_code" or something else with "product" in the variable name, or sometimes an abbreviations such as "prod". If you have labels assigned sometimes you get used to seeing "Product" and forget the actual variable name behind the label.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 495 views
  • 0 likes
  • 3 in conversation