Hello Everyone, So I figured out the first part to my question which was to modify this code: proc sql; title '2007 Purchases by Country'; select distinct c.Country, &Purchases as 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 desc; quit; To where it would write out the values of Country and Purchases for the first returned row into macro variables called Country and Country_Purchases, which this is what I got: %let Purchases=sum(Total_Retail_Price); proc sql noprint; title '2007 Purchases by Country'; select distinct c.Country, &Purchases as Purchases into:Country1, :Country_Purchases1 from orion.Order_Fact as o, orion.Customer as c; quit; So the next part of my problem is to modify this code: proc sql; title '2007 Purchases by Country'; select distinct c.Customer_Name, &Purchases as Purchases label='Purchases' format=dollar10.2 from orion.Order_Fact as o, orion.Customer as c where o.Customer_ID=c.Customer_ID and year(Order_Date)=2007 and c.Country='US' group by c.Customer_Name having &Purchases>1 order by calculated Purchases desc; quit; Which I modified it to this: proc sql; title1 "2007 &Country1 Customer Purchases"; title2 "Total &Country1 Purchases: &Country_Purchases"; select distinct c.Customer_Name, &Purchases as Purchases label='Purchases' format=dollar10.2 from orion.Order_Fact as o, orion.Customer as c where o.Customer_ID=c.Customer_ID and year(Order_Date)=2007 and "&Country1"=c.Country group by "&Country1", c.Customer_ID having &Purchases>1 order by calculated Purchases desc; quit; The problem I am having now is that I am only producing one countries reports, which is AU for Australia, and not all of the countries reports on separate pages. So I am not sure if I went wrong with the first part of my modified code or if I am going wrong with my second query. I know this is a long post, but if anyone could help me with this, it would be greatly appreciated! Thanks!! Alisa
... View more