The Sold tables having variable.
Alphabetic List of Variables and Attributes
# Variable Type Len Format Label
4 ShipDay Num 8 WeekDAY. Day of the Week of Shipment
3 dates Num 8 MMDDYY10. Date accessory(s) shipped
1 orders Num 8 Number of Order
2 quantity Num 8 Quantity
I want to display table containing 3 variables summarizing by year, the total number of accessories sold each month;
proc sql;
select year(datepart(dates)) as A_Year, month(datepart(dates)) as A_Month , sum(quantity) as TTL_Accessories
from Sold
group by calculated S_Year,
quit;
I am getting log error as
ERROR: The following columns were not found in the contributing tables: quit.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
97
98 NOTE: The SAS System stopped processing this step because of errors.
ERROR: The following columns were not found in the contributing tables: quit.
If you get such weird error messages then always ask yourself what the heck could trigger SAS to get so confused.
Very often such errors are the result of a forgotten semicolon - and as you do have a comma instead of a semicolon the SAS compiler believes the "quit" is still part of your group by statement and therefore must be a variable.
BTW:
If you also create a Month variable then you'll get 12 rows per year but if you only group by year then all 12 rows in the same year will have the same sum. If you want montly sums then you need to add the month to the group by clause.
ERROR: The following columns were not found in the contributing tables: quit.
If you get such weird error messages then always ask yourself what the heck could trigger SAS to get so confused.
Very often such errors are the result of a forgotten semicolon - and as you do have a comma instead of a semicolon the SAS compiler believes the "quit" is still part of your group by statement and therefore must be a variable.
BTW:
If you also create a Month variable then you'll get 12 rows per year but if you only group by year then all 12 rows in the same year will have the same sum. If you want montly sums then you need to add the month to the group by clause.
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 25. Read more here about why you should contribute and what is in it for you!
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.