/******************* URBAN INSTITUTE MACRO LIBRARY *********************
: Fdate
Macro: Autocall macro to put a formatted version of
Description
a date value into a macro variable.
: Open code
Use
: Peter Tatian
Author
***********************************************************************/
fdate(
%macro fmt=mmddyy10., /* SAS date format to use for formatting date */
mvar=fdate, /* Name of macro variable to store formatted date */
date="&sysdate9"d, /* Date to reformat (default is system date) */
quiet=Y /* Suppress message in log (Y/N) */
);
/*************************** USAGE NOTES *****************************
:
SAMPLE CALLfdate( )
%*********************************************************************/
/*************************** UPDATE NOTES ****************************
03-17-06 Added DATE= and QUIET= parameters.
*********************************************************************/
***** ***** ***** MACRO SET UP ***** ***** *****;
%
&mvar;
%global
***** ***** ***** ERROR CHECKS ***** ***** *****;
%
***** ***** ***** MACRO BODY ***** ***** *****;
%
data _null_;symput("&mvar",left(put(&date,&fmt)));
call
run;
%if %mparam_is_no( &quiet ) %then %do;
%note_mput( macro=FDATE, msg=Macro variable %upcase(&mvar) set to &&&mvar. )
%end;
***** ***** ***** CLEAN UP ***** ***** *****;
%
%mend fdate;
/************************ UNCOMMENT TO TEST ***************************
fdate( quiet=n )
%fdate( mvar=month, fmt=monname9., quiet=n )
%/**********************************************************************/
Format Date Values in Macro
Purpose: Autocall macro to put a formatted version of a date value into a macro variable.