Hello Everyone,
I am working on a problem where I have to take the problem that I worked on earlier and automate it through creating macros.
I need to take the values of Country and Purchases in my script and modify those to where it writes the first returned row into a macro called Country and Country_Purchases.
This is my first attempt at this script:
%let Purchases=sum(Total_Retail_Price);
proc sql noprint inobs=1;
title '2007 Purchases by Country';
select distinct c.Country, &Purchases as Purchases
into:Country, :Country_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;
I know this is completely wrong as far as reading the first returned row into a macro.
Could someone let me know where I am going wrong with this?
Thanks!
Alisa
can you paste the log?
Hi Hima,
Well, I found on one of the programming documents that I needed to do this with my code:
%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;
Now, I'm having another problem with the second part of the question which I'll create another post for.
Thanks for replying!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: