Appending to an Existing PDS

As mentioned in "Troubleshooting and Known Problems," you cannot use OPENMODE=APPEND when writing to an existing partitioned data set (PDS). Because of the internal processing required to accomplish BY-group processing, you cannot use the BY group feature of the Data Set Formatter and write to a PDS.

We realize that this limitation may cause you some problems, so we offer you the following work-around. If you have questions or problems using this work-around, please contact SAS Technical Support.

The Work-Around

Add the following code to the top of your SAS program:

    * Compress the trailing blanks from the userid       *
      %let prefix=%cmpres(&sysuid); 
                                   
    * Allocate both your sequential data set and the PDS *
      filename seq "&prefix..scratch.seq" lrecl=255 recfm=v            
        disp=(new,delete,delete);                                      
                                                                  
      filename pds "&prefix..pds(member)" lrecl=255 recfm=v dsorg=po
        disp=(new,catlg,delete);                                       

Put your entire SAS program after the above code. Add the following code after your SAS program:

 
    * Copy the sequential data set to your PDS           *
      data _null_; infile seq; file pds; input; put _infile_; run;