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
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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