proc summary data=sashelp.prdsal2 print ;
class county month product actual_sales;
var year;
output out= prdsales actual_sales sum=;
run;
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
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 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.
What is the question here?
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.