Chapter Contents |
Previous |
Next |
Moving and Accessing SAS Files across Operating Environments |
Here are several suggestions for verifying transport files. The first two methods are performed before and after the file transfer. The final method is performed after the file transfer.
Restoring the Transport File at the Source Host |
This example shows the creation of a transport file:
libname xptlib xport 'xptlib.dat'; /* create a transport file for the entire library */ proc copy in=work out=xptlib; run;PROC COPY reads the library from the libref WORK and writes the transport file to the libref XPTLIB.
This example restores the transport file just created back to the source host:
libname test 'test'; /* restore the transport file at the source host */ proc copy in=xptlib out=test; run;The value for the OUT= option in the example that creates the transport file becomes the value for the IN= option in the example that restores the transport file back to the source host. To protect against overwriting the original data library that is created in WORK, direct output to the library TEST. PROC COPY reads the transport file from the libref XPTLIB and restores it to the libref TEST in native format.
For complete details about the syntax for these procedures, see SAS Procedures Guide.
Verify the outcome of this test by viewing the SAS log at the source host. If the transport operation succeeded at the source host, then you can assume that the transport file content is correct. If the transport operation failed, then you can assume that the transport file was not created correctly. In this case, re-create the transport file and restore it again at the source host.
Verifying the Size of a Transport File |
vms> dir/size=all *dat Directory HOSTVAX:[JOE.XPTTEST] XPTDS.DAT;1 7/8 XPTLIB.DAT;1 7/8
The sizes of both files are 7/8 of a block, which is equivalent to 448 bytes.
Here is a UNIX example:
$ ls -l *dat -rw-r--r-- 1 joe mkt 448 Oct 13 14:24 xptds.dat -rw-r--r-- 1 joe mkt 890 Oct 13 14:24 xptlib.dat
The size of XPTDS.DAT is 448 bytes; XPTLIB.DAT, 890 bytes.
The method for listing a file size varies according to host.
Compare the size of the transport file on the source host with the size of the transport file that is transferred to the target host. If the sizes of the transport files are identical, then you can assume that the network successfully transferred these files. If the sizes are not the same, you can assume that the network transfer failed. In this case, review the transfer options and re-try the transfer.
Comparing the Original Data Set with the Restored Data Set |
You can use the CONTENTS procedure to reveal discrepancies between the original data set at the source host and the restored data set at the target host. A comparison could reveal a misconception about the transported data. For example, upon examination of the data set, you could learn that an entire library of data sets was mistakenly transported rather than only the intended data set.
Use the CONTENTS procedure or the PRINT procedure to list the contents of members of type DATA.
In this example, PROC CONTENTS shows the contents of a single data set in a library:
Using PROC CONTENTS to Show the Contents of a Data Set
proc contents data=xptds._all_; CONTENTS PROCEDURE Data Set Name: XPTDS.GRADES Observations: . Member Type: DATA Variables: 4 Engine: XPORT Indexes: 0 Created: . Observation Length: 32 Last Modified: . Deleted Observations: 0 Protection: Compressed: NO Data Set Type: Sorted: NO Label: -----Alphabetic List of Variables and Attributes----- # Variable Type Len Pos ----------------------------------- 4 FINAL Num 8 24 1 STUDENT Char 8 0 2 TEST1 Num 8 8 3 TEST2 Num 8 16 DATAPROG: Creates datasets for TRANSPORTING CONTENTS PROCEDURE -----Directory----- Libref: XPTDS Engine: XPORT Physical Name: $1$DUA330:[HOSTVAX.JOE.XPTTEST]XPTDS.DAT # Name Memtype Indexes --------------------------- 1 GRADES DATA
If you detect problems, re-create the transport file and restore it again at the source host.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.