SAS Users Group for Institutional Researchers (SUGIR)

Reply
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.
Highlighted
New Contributor
Posts: 3
SAS Macro Toolbox
[ Edited ]

After speaking with a few other members of SUGIR I was encouraged to post this. Over my short time in IR I have created a handful of Macros to make my life simpler. I was repeating a lot of code so I took some of that and turned them into Macros.

 

Link to the SAS Macro Toolbox: SAS Macro Toolbox

 

What is included:

- 11 macros that should be universal for anyone to use out of the box

- Program which contain samples as to how to use the macros

- Documentation related to the macros

 

Notes:

- All of the included macros should work on any version of SAS starting with v9.2, Baylor is currently on SAS 9.4M3

- Baylor University has configured a system directory that auto-compiles these macros whenever a user launches a SAS Session

- The macro 'system_options' is utilized in a few of the other macros so be sure to compile that macro if needed

- The 'dset_*' macros are very useful if you need to do a data merge and are worried about data truncation. They also have uses towards saving storage space (though nowadays this should not be a concern)

- I do have 2 other macros that are not included in the zip archive because they are specifically configured for Baylor University

*TERM_LIST_GENERATOR: This macro will generate a list of terms based on parameters set and store it into a macro variable. If your Unviersity is a Banner school I would be happy to share this macro. You will most likey have to edit the macro to some extent as there is some specific coding for Baylor Terms

*ALL_ORACLE_TABLES: This macro is used to quickly declare oracle-based tables used at Baylor. Again, if you would like this macro please send me a message. I will need to scrub the macro first as it currently contains specific Baylor configurations.

 

UPDATE (2016-06-16):

After attending SAS Global Forum 2016, I have made a few updates to the macros. The overall functionality of the macros is the same. In order to download the updated macros please use the below link.

 

UPDATE (2016-06-24):

For the DSET_* macros I have changed the default value for option 'CHARONLY' to equal 'Y'. This means that by default the DSET_* macros will ONLY process character variables.

 

UPDATE (2016-10-06):

- Added new macro 'CONVERT_ALLVAR_NUM_TO_CHAR'. This macro will convert ALL numeric variables to character variables. This includes date variables

- Updated macro Get_Filepath to supresss warning messages if the directory path (aka filepath) or filename contains an '&' 

 

UPDATE (2017-03-22):

- Fixed a bug within 'CONVERT_ALLVAR_NUM_TO_CHAR' and 'DSET_LENGTH_*' macros where temporary variables created would exceed 32 characters.

 

If you have any questions feel free to contact me.

 

Philip Jou

System Administrator

Baylor University

Philip_Jou@baylor.edu

Attachment
Occasional Contributor
Posts: 7
Re: SAS Macro Toolbox

Philip, so happy to see your post!  Nice visiting at TAIR.  I've downloaded the code you provided.  Thanks so much!

Lisa

Occasional Contributor
Posts: 5
Re: SAS Macro Toolbox

This is so awesome!!!  Thank you!

New Contributor
Posts: 3
Re: SAS Macro Toolbox

Thank you so much, Phillip!! Appreciate it greatly!

 

Mike Johnston