****************************************************************************************************
****************************************************************************************************
* PROGRAM: createlibref.sas
* Created (mm/dd/yyyy): 11/28/2017
*--------------------------------------------------------------------------------------------------
* PURPOSE: This macro creates concatenated libref from a list of DPs and a file path,
* automatically defaults to most recent version, and checks for the existence of each folder path
* - dplist: list of DPs separated by a space
* - dpinfofile: file containing list of DPs and optional path
* - dataroot: location of /data folder in the standard structure /data/[version]/[dp]/msoc/
* - signaturefile: signature file from which to extract DP metadata
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro createlibref(dplist=,
**********************************************************
macro %dynamiclibref automatically creates libnames for
each DP based on K:/Sentinel folder structure
*********************************************************;
%macro dynamiclibref(dp_list=);
filename root "&dataroot.";
/*Retrieve each version*/
name=upcase(dread(did,i));
else put 'Could not open directory';
proc sort data=files_and_folders;
/*Put name of versions into macro variable*/
select lowcase(name) into: versions separated by ' '
where substr(upcase(name),1,1) in ('V', 'B', 'T')
order by case substr(upcase(name),1,1)
/*For each DP, confirm the existence of the directory. Only include directories that exist in the final concatenated libname*/
%let dp_list = %lowcase(&dp_list);
%let DpCnt = %sysfunc(Countw(&dp_list)); /*Number of DPs to loop*/
%let VerCnt = %sysfunc(Countw(&versions)); /*Number of versions to loop*/
%let DPSITEID = %scan(&dp_list,&a); /*Current DP*/
/*reset in_version counter*/