BookmarkSubscribeRSS Feed
dereck255
Fluorite | Level 6

Hello,

 

I'm working with a dataset that has a list of action items where each action item has the owner name. Note that some owner has more than one action item.

 

My goal is to take the list of action items, divide them up by each owner, and email that Excel sheet to each owner. I'm pretty new to SAS Macros and I'm having difficulty thinking of what's the best way to do it. Currently, I'm writing code specific to each owner:

 

data ownername1;

set all;

if owner=owner1;

run;

 

data ownername2;

set alll

if owner=owner2;

run;

 

etc...

 

Then I'm going to proc export for each owner dataset and have SAS email out that report, however, I don't want an email to be sent if there are no action items. Clearly this is taking a lot of time and I can't help but think there's a better way to do this. Any ideas to get me started?

 

Thanks,

 

Derek

3 REPLIES 3
Reeza
Super User

Hard to say with just what you've posted here. It depends on how much difference there is between each 'action'.

 

It could be easy to say, create a macro for each action and then use call execute to loop through your list and execute the correct macro for each user. 

Or a generic macro that takes the action for each user and somehow filters out the correct action so the action is a parameter to the macro. 

dereck255
Fluorite | Level 6

Hi Reeza,

 

There's no real difference between the actions. Either the "Description" column has some detail in it, or it's blank (blank meaning that there are no action items). 

 

Do you have any basic macro literature I can look at? I've googled my situation and the macros that might be helpful are way too complex for me at this point.

 

Thanks!

Reeza
Super User

Basic Intro here:

http://www.ats.ucla.edu/stat/sas/seminars/sas_macros_introduction/

 

Then read through the examples:

https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Ap...

 

The examples have most of what people should need for a starter. 

Then search through lexjansen for any number of papers on the topic:

http://www.lexjansen.com/phuse/2014/cc/CC06.pdf

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1900 views
  • 0 likes
  • 2 in conversation