Replacing the Generated Code for a Job or Transformation

Problem

You want a result that cannot be easily achieved with the code that is generated for a job or transformation. Extensive changes are needed to the generated code.

Solution

You can write a SAS program to achieve the desired result. Then you can replace the generated code for the job or transformation with your program. You can copy your code into the metadata for the transformation or job (Import SAS Code), or you can specify a path to a file that contains your SAS program (Attach to SAS Code). If you change an attached source file later, the changes are reflected in the code that you update.

Tasks

Replace the Generated Code for a Job or Transformation

Perform the following steps to replace existing code into a job or transformation.
  1. Open the Code tab in the properties window for the job or transformation.
  2. Click User written body or All user written in the Code generation mode field. Note that any non-user-written portion of the code is dimmed when you click User written body. You cannot modify this part of the code.
  3. Place the cursor in an editable section of the Code tab.
  4. Click the Open icon on the toolbar of the Code tab.
  5. Click either Import SAS Code or Attach to SAS Code. Then you can copy the SAS code that is contained in the selected file into the Code tab of a job or transformation.
    Note: When you click Import SAS Code, the code is copied without establishing a link to the source file. If you change an imported source file later, the changes are not reflected in the code that you update. However, when you click Attach to SAS Code, the code is copied with a link to the source file. If you change an attached source file later, the changes are reflected in the code that you update.
  6. Click Local or Remote to access the Open window. The Local window enables you to open a file from your client computer. The Remote window enables you to open a file from the SAS Application Server.
    Note: Both local and remote access are available for the import SAS code function. Only remote access is available for the attach to SAS code function.
  7. Click Save or Save As on the toolbar for the tab. The Save option enables you to save the code in the editor as a metadata object (instead of saving the code into a file). The Save As option opens the Save File window, where you can either save a name and description for the metadata object (code in the editor) or save the contents of the editor as a file.
    Note: The Save and Save As options apply your changes to the current session. To make your changes persist after the current session, you must save the entire job. To save the entire job, select Filethen selectSave from the menu bar on the desktop.
  8. Click OK to apply the changes to the current session and close the properties window.