Hi Art, So I modified my code to be like yours in this way: %let Purchases=sum(Total_Retail_Price); proc sql; title '2007 Purchases by Country'; select distinct c.Country, &Purchases label='Purchases' from orion.Order_Fact as o, orion.Customer as c where o.Customer_ID=c.Customer_ID and year(Order_Date) =2007 group by c.Country having &Purchases>1 order by calculated &Purchases; quit; This unfortunately still does not work. Here is the error I get from the log: 1328 %let Purchases=sum(Total_Retail_Price); 1329 proc sql; 1330 title '2007 Purchases by Country'; 1331 select distinct c.Country, 1332 &Purchases label='Purchases' 1333 from orion.Order_Fact as o, 1334 orion.Customer as c 1335 where o.Customer_ID=c.Customer_ID and 1336 year(Order_Date) =2007 1337 group by c.Country 1338 having &Purchases>1 1339 order by calculated &Purchases; NOTE: Line generated by the macro variable "PURCHASES". 1 sum(Total_Retail_Price) - 22 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?, AND, BETWEEN, CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=. So I am not sure I am going wrong somewhere with how I typed this in.
... View more