Back to Tech Corner
SAS Programming

SAS Programming – Changing Output Data Type at Source to a Foreign Format

Use Case:

SAS data preparation is run on a WINDOWS OS based environment, the resulting data is sent to another department or a downstream customer who further processes the data, however, their OS is Linux.

Question:

Could data be prepared at source SAS platform (IN) to be ready for processing in the target environment (Linux) without employing CEDA (Cross-Environment Data Access) for faster processing?

Here we are not discussing the pros and cons of CEDA, our purpose is to provide data to target processor for efficient and faster processing without incurring CEDA cost, that is, changing SAS file's native format to a foreign format.

Solution

Two SAS options OUTREP1 and PROC COPY are used to produce dataset in Linux format while processing on WIN environment. The library of data sets in Windows native format is copied to a library of data sets in Linux x64 foreign format

Steps:

  1. Create LIBNAME with OUTREP option to specify the foreign format for OUTPUT
  2. Create LIBNAME pointing at native data as the input data
  3. Use the COPY procedure to copy the file in native format to the file in foreign format with NOCLONE option, which chooses the data representation of the file in foreign format instead of the file in native format.

Example:

/* Step 1: Create LIBNAME with OUTREP option for Linux format */
libname linuxlib '/data/linux' outrep=LINUX_X86_64;

/* Step 2: Create LIBNAME pointing at native Windows data */
libname winlib 'c:\sasdata\win';

/* Step 3: Use PROC COPY with NOCLONE option */
proc copy in=winlib out=linuxlib noclone;
run;

1 OUTREP: https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ledsoptsref/n0p1yuyzltd52jn1dubaao0dlk2m.htm