SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 45363: Sorting a SAS® data set using IBM DFSORT as the host sort utility might cause the last byte of the data set to be replaced with x'00'

DetailsHotfixAboutRate It
If you sort a SAS data set using IBM DFSORT as the host sort utility, the last byte of the data set might be replaced with x'00'. This occurs under the following conditions:

  1. One of the BY variables extends beyond offset 4096
  2. The same variable is the next-to-last variable
  3. And the last variable in the data set is 1 byte long.
In this scenario, the last variable is replaced with x'00'.

There are a few ways to circumvent this problem.

  • Reorder the variables within the SAS data set so that the BY variables occur within the first 4096 bytes of the SAS data set.
  • Ensure that the last variable in the data set is not a 1-byte character variable.
  • Use the SAS internal sort by setting the SAS system option SORTPGM=SAS before the PROC SORT step.
To determine the order of the variables in the data set, execute the CONTENTS procedure (PROC) on that data set. The following example shows a data set WORK.PROBLEM that could experience this problem if you sorted on the X5 variable:
proc contents data=work.problem position;   
run; 
The PROC CONTENTS output shows the length of the observation and the relative position of the variables.
                                                                             
                            The CONTENTS Procedure                           
                                                                             
 Data Set Name        WORK.PROBLEM                 Observations          0   
 Member Type          DATA                         Variables             6   
 Engine               V9                           Indexes               0   
 Created              Friday, January 13,          Observation Length    4201
                      2012 02:42:59 PM                                       
 Last Modified        Friday, January 13,          Deleted Observations  0   
                      2012 02:42:59 PM                                       
 Protection                                        Compressed            NO  
 Data Set Type                                     Sorted                NO  
 Label                                                                       
 Data Representation  MVS_32                                                 
 Encoding             open_ed-1047  Western                                  
                      (OpenEdition)                                          


 .... 

                                                     
    Variables in Creation Order             
                                                                 
                                                   
       #    Variable    Type     Len           
                                               
       1    X1          Char    1000           
       2    X2          Char    1000           
       3    X3          Char    1000           
       4    X4          Char    1000           
       5    X5          Char     200        <--- sort on next-to-last variable   
       6    Y           Char       1        <--- last variable is length 1       
                               

Click the Hot Fix tab in this note to access the hot fix for this issue.

Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemBase SASZ64
z/OS9.4 TS1M0
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.