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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 599 views
  • 0 likes
  • 3 in conversation