**************************************************************************************************** * PROGRAM OVERVIEW **************************************************************************************************** * * PROGRAM: utility_macros.sas * Created (mm/dd/yyyy): 03/14/2022 * *-------------------------------------------------------------------------------------------------- * PURPOSE: * These are utility macros that are used to verify if a dataset contains observations. * * Program inputs: * * Program outputs: * * PARAMETERS: * ISDATA(dataset=) * dataset = Name of a dataset for which we want to verify if it contains observations * * Programming Notes: * * *-------------------------------------------------------------------------------------------------- * CONTACT INFO: * Sentinel Coordinating Center * info@sentinelsystem.org * *-------------------------------------------------------------------------------------------------- ***********************************************************************************************; *Macro to determine whether a dataset is empty or not; %MACRO ISDATA(dataset=); %PUT =====> MACRO CALLED: ms_macros v1.0 => ISDATA; %GLOBAL NOBS; %let NOBS=0; %if %sysfunc(exist(&dataset.))=1 and %LENGTH(&dataset.) ne 0 %then %do; data _null_; dsid=open("&dataset."); call symputx("NOBS",attrn(dsid,"NLOBS")); run; %end; %PUT &NOBS.; %put NOTE: ********END OF MACRO: ms_macros v1.0 => ISDATA ********; %MEND ISDATA;