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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.