/******************* URBAN INSTITUTE MACRO LIBRARY *********************
: DSLibOnly
Macro: Autocall macro that returns the library name portion of a
Description
libname.dataset specification.
: Function
Use
: Peter Tatian
Author
***********************************************************************/
DSLibOnly( LibDataSpec );
%macro
/*************************** USAGE NOTES *****************************
:
SAMPLE CALLDSLibOnly( Libname.Dataset )
%
returns Libname*********************************************************************/
/*************************** UPDATE NOTES ****************************
08/27/06 Peter A. Tatian
*********************************************************************/
***** ***** ***** MACRO SET UP ***** ***** *****;
%
%local dot ret;
***** ***** ***** ERROR CHECKS ***** ***** *****;
%
***** ***** ***** MACRO BODY ***** ***** *****;
%
%let dot = %sysfunc( indexc( &LibDataSpec, '.' ) );
%if &dot > 0 %then %do;
%let Ret = %sysfunc( substr( &LibDataSpec, 1, &dot - 1 ) );
&Ret
%end;%else %do;
** No library, return WORK **;
%
WORK
%end;
***** ***** ***** CLEAN UP ***** ***** *****;
%
%mend DSLibOnly;
/************************ UNCOMMENT TO TEST ***************************
options mprint symbolgen mlogic;= Libname.DataSet;
%let test1 %let test1_ds = %DSLibOnly( &test1 );
=&test1 test1_ds=&test1_ds;
%put test1= DataSet;
%let test2 %let test2_ds = %DSLibOnly( &test2 );
=&test2 test2_ds=&test2_ds;
%put test2/**********************************************************************/
Dataset Library Name
Purpose: Autocall macro that returns the library name portion of a libname.dataset specification.