BookmarkSubscribeRSS Feed
InfoAlisaA
Calcite | Level 5

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

2 REPLIES 2
Hima
Obsidian | Level 7

can you paste the log?

InfoAlisaA
Calcite | Level 5

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!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 552 views
  • 0 likes
  • 2 in conversation