The automatic macro variable &SYSINFO stores a return code that provides information about the result of a comparison between two data sets performed by PROC COMPARE. The value stored in the return code enables you to determine the extent to which the two data sets differ.
Bit testing using the value of &SYSINFO can be performed in a DATA step to write messages to the SAS Log when differences between the two data sets are detected. PROC COMPARE must be run first in order to set the &SYSINFO values.
See the sample code on the Full Code tab for an illustration.
A table interpreting the SYSINFO return code from PROC COMPARE can be found in the documentation.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
In the code below, bit testing using the value of &SYSINFO is performed in a DATA step to write messages to the SAS Log when differences between the two data sets are detected. PROC COMPARE must be run first in order to set the &SYSINFO values.
/* Create sample data sets */
data one;
length c $5;
input id a b c $;
datalines;
1 100 201 abcde
2 200 300 wxyz
3 300 200 ghijk
;
run;
data two;
length c $10;
input id a b $ c $ e;
datalines;
1 100 200 abcde 10
2 200 305 wxyz 20
;
run;
/* Perform the comparison with PROC COMPARE */
proc compare base=one compare=two error noprint;
id id;
run;
%let rc=&sysinfo; /* Set the &SYSINFO value */
/* Perform bit testing of the value from the return code */
/* to determine the differences between the data sets. */
data _null_;
/* Test for data set label */
if &rc = '1'b then
put '<<<< Data sets have different labels';
/* Test for data set types */
if &rc = '1.'b then
put '<<<< Data set types differ';
/* Test for label */
if &rc = '1.....'b then
put '<<<< Variable has different label';
/* Test for base observation */
if &rc = '1......'b then
put '<<<< Base data set has observation not in comparison data set';
/* Test for length */
if &rc = '1....'b then
put '<<<< Variable has different lengths between the base data set and the comparison data set';
/* Variable in base data set not in compare data set */
if &rc ='1..........'b then
put '<<<< Variable in base data set not found in comparison data set';
/* Comparison data set has variable not in base data set */
if &rc = '1...........'b then
put '<<<< Comparison data set has variable not contained in the base data set';
/* Test for values */
if &rc = '1............'b then
put '<<<< A value comparison was unequal';
/* Conflicting variable types */
if &rc ='1.............'b then
put '<<<< Conflicting variable types between the two data sets being compared';
run;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
<<<< Base data set has observation not in comparison data set <<<< Variable has different lengths between the base data set and the comparison data set <<<< Comparison data set has variable not contained in the base data set <<<< Conflicting variable types between the two data sets being compared NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds
Type: | Sample |
Date Modified: | 2011-12-07 10:28:04 |
Date Created: | 2011-12-02 14:19:06 |
Product Family | Product | Host | Product Release | SAS Release | ||
Starting | Ending | Starting | Ending | |||
SAS System | Base SAS | z/OS | 9.21_M3 | 9.2 TS2M3 | ||
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft Windows XP 64-bit Edition | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft® Windows® for x64 | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft Windows Server 2003 Datacenter Edition | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft Windows Server 2003 Enterprise Edition | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft Windows Server 2003 Standard Edition | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft Windows Server 2003 for x64 | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft Windows Server 2008 | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft Windows Server 2008 for x64 | 9.21_M3 | 9.2 TS2M3 | ||||
Microsoft Windows XP Professional | 9.21_M3 | 9.2 TS2M3 | ||||
Windows 7 Enterprise 32 bit | 9.21_M3 | 9.2 TS2M3 | ||||
Windows 7 Enterprise x64 | 9.21_M3 | 9.2 TS2M3 | ||||
Windows 7 Home Premium 32 bit | 9.21_M3 | 9.2 TS2M3 | ||||
Windows 7 Home Premium x64 | 9.21_M3 | 9.2 TS2M3 | ||||
Windows 7 Professional 32 bit | 9.21_M3 | 9.2 TS2M3 | ||||
Windows 7 Professional x64 | 9.21_M3 | 9.2 TS2M3 | ||||
Windows 7 Ultimate 32 bit | 9.21_M3 | 9.2 TS2M3 | ||||
Windows 7 Ultimate x64 | 9.21_M3 | 9.2 TS2M3 | ||||
Windows Vista | 9.21_M3 | 9.2 TS2M3 | ||||
Windows Vista for x64 | 9.21_M3 | 9.2 TS2M3 | ||||
64-bit Enabled AIX | 9.21_M3 | 9.2 TS2M3 | ||||
64-bit Enabled HP-UX | 9.21_M3 | 9.2 TS2M3 | ||||
64-bit Enabled Solaris | 9.21_M3 | 9.2 TS2M3 | ||||
HP-UX IPF | 9.21_M3 | 9.2 TS2M3 | ||||
Linux | 9.21_M3 | 9.2 TS2M3 | ||||
Linux for x64 | 9.21_M3 | 9.2 TS2M3 | ||||
OpenVMS on HP Integrity | 9.21_M3 | 9.2 TS2M3 | ||||
Solaris for x64 | 9.21_M3 | 9.2 TS2M3 |