BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am new to SAS and intend to use SAS to generate some complex analyses on multiple datasets. A significant portion of the analyses is the same for each dataset. I'm looking for some guidance on how best to implement these analyses so that code is shared rather than copied.

Can someone direct me to a resource (book, document, etc) that can help me?
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
If you refer to these user-group presentations
http://www2.sas.com/proceedings/sugi23/Coders/p81.pdf
http://www2.sas.com/proceedings/sugi31/014-31.pdf
http://www2.sas.com/proceedings/forum2007/006-2007.pdf
http://www2.sas.com/proceedings/sugi27/p021-27.pdf

you will see that a lot of folks use the SAS Macro Facility as part of their source code management system.

In order to effectively use the SAS macro facility, you should
1) have a working SAS program
2) convert that program to use macro variables (i.e. change the program to use a few macro variables like dataset name)
3) convert the program with generic macro variables into a MACRO program and
add any conditional macro programming logic at this point (if it's the last day of the month, then also generate and execute the month-end report code).
4) have a system of organized folders, directories and file names where the data and programs live

The SAS documentation has extensive material on the use of the SAS Macro Facility and there are many books by users published by SAS Press on the topic.

Your use of the SAS Macro facility can be as simple or as complex as you need. But the key is to first have a working SAS program before you try to convert it to use SAS macro processing.

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 1052 views
  • 0 likes
  • 2 in conversation