PING  0.9
Statistical data handling and processing in production environment
Integration
%silc_db_locate(survey, time, geo=, db=, src=,
_ftyp_=, _ds_=, _path_=,
cds_transxyear=META_TRANSMISSIONxYEAR, clib=LIBCFG);

Arguments

Returns

Examples

Let us consider the following simple example:

%let ftyp=;
%silc_db_locate(X, 2014, _ftyp_=ftyp);

will return ftyp=r because cross-sectional data are normally transmitted via regular (R) files since 2014. We can further retrieve the location of the corresponding H file:

%let ds=;
%let path=;
%silc_db_locate(X, 2014, geo=AT, db=H, _ds_=ds, _path_=path);

will set path=/ec/prod/server/sas/0eusilc/main/at/r14 and ds=rat14h, while

%let ds=;
%let path=;
%silc_db_locate(X, 2014, geo=AT DE, db=H, _ds_=ds, _path_=path);

will set path=/ec/prod/server/sas/0eusilc/main/at/r14 /ec/prod/server/sas/0eusilc/main/de/c14 and ds=rat14h cde14h. It is then possible to reconstruct the full paths:

%let file=%list_append(&path, &ds, zip=%quote(/), rep=%quote( ));
%let file=%list_append(&file, %list_ones(%list_length(&file), item=sas7bdat), zip=%quote(.));

sets file=/ec/prod/server/sas/0eusilc/main/at/r14/rat14h.sas7bdat /ec/prod/server/sas/0eusilc/main/de/c14/cde14h.sas7bdat. Finally:

%let ftyp=;
%let ds=;
%let path=;
%silc_db_locate(X, 2014, geo=AT DE, db=R H, _ftyp_=ftyp, _ds_=ds, _path_=path);

sets ftyp=r c, path=/ec/prod/server/sas/0eusilc/main/at/r14 /ec/prod/server/sas/0eusilc/main/at/r14 /ec/prod/server/sas/0eusilc/main/de/c14 /ec/prod/server/sas/0eusilc/main/de/c14 and ds=rat14r rat14h cde14r cde14h.

Run %_example_silc_db_locate for more examples.

Notes

  1. The existence of returned path (in _path_) and dataset (in _ds_) is not verified.
  2. In order to retrieve the type of the transmission file (returned through _ftyp_), this macro runs in practice:
PROC SQL noprint;
SELECT Y&time
INTO :&_ftyp_
%if %list_length(&geo)>0 %then %do;
SEPARATED BY " "
%end;
FROM &clib..&cds_transxyear
WHERE transmission="%upcase(&survey)" and
%if %list_length(&geo)>0 and &src=raw %then %do;
geo in (%list_quote(&geo))
%end;
%else %do;
missing(geo)
%end;
;
quit;

Following, to retrieve the common type ftyp of transmission files for a given year time and a survey of type survey, simply run:

%let ftyp=;
%silc_db_locate(&survey, &time, _ftyp_=ftyp);
  1. Note that from the output path and dataset, you can easily reconstruct the full path(s) (directory name + dataset name + extension) of the original SAS files, e.g. for given survey, db, time and geo:
%let ds=;
%let path=;
%silc_db_locate(survey, db, time, geo=geo, _ds_=ds, _path_=path);
%let fullpath=%list_append(&path, &ds, zip=%quote(/), rep=%quote( ));
%let fullpath=%list_append(&fullpath, %list_ones(%list_length(&fullpath), item=sas7bdat),
zip=%quote(.), rep=%quote( - ));

See also

silc_db_locate (Stata), %silc_ds_extract, %meta_transmissionxyear.