BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BrahmanandaRao
Lapis Lazuli | Level 10
proc summary data=sashelp.prdsal2 print ;
class county month product actual_sales;
var  year;
output out= prdsales actual_sales sum=;
run;

Anandkvn_0-1616566121650.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

A random variable name on the OUTPUT statement is going to throw an error if not used properly.

In your picture the variable name underlined has no context.

All those "expected" are Statistics or the option specifier / . Statistics, associated variables and variable names are expected. But at name without context in one of those places is invalid.

 

If you are creating a statistic for a specific variable you use statistic(variablename(s))= <name of new variable(s) if desired

View solution in original post

5 REPLIES 5
qoit
Pyrite | Level 9

I am quite unclear regarding what you are trying to achieve here. OUT= option of the OUTPUT statement is meant to output the created data set by the SUMMARY procedure. Adding to it, the "ACTUAL_SALES" variable does not exist in the data set sashelp.prdsal2, and therefore the error message. Use the below, or better yet, the SQL procedure.


proc means data=sashelp.prdsal2 nway sum;
class county month product;
var  actual;
output out= prdsales (drop=_type_ _freq_) sum= / autoname;
run;
BrahmanandaRao
Lapis Lazuli | Level 10
Actual sales variable in prdsal2 dataset why it shows error variable not found
Kurt_Bremser
Super User

@BrahmanandaRao wrote:
Actual sales variable in prdsal2 dataset why it shows error variable not found


The variable is positively NOT there:

proc sql;
select name from dictionary.columns
where libname ="SASHELP" and memname = "PRDSAL2";
quit;

Result:

Column Name
COUNTRY
STATE
COUNTY
ACTUAL
PREDICT
PRODTYPE
PRODUCT
YEAR
QUARTER
MONTH
MONYR

You may have meant to use ACTUAL.

 

When SAS tells you something ain't there, while you think otherwise, then it's always YOU who's in error.

PeterClemmensen
Tourmaline | Level 20

What is the question here?

ballardw
Super User

A random variable name on the OUTPUT statement is going to throw an error if not used properly.

In your picture the variable name underlined has no context.

All those "expected" are Statistics or the option specifier / . Statistics, associated variables and variable names are expected. But at name without context in one of those places is invalid.

 

If you are creating a statistic for a specific variable you use statistic(variablename(s))= <name of new variable(s) if desired

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 8026 views
  • 0 likes
  • 5 in conversation