Considerations for Manually Editing Code

Before You Manually Edit Code

The code generation features in SAS Visual Data Builder can generate a lot of SAS statements with a few simple clicks. Depending on your needs, you might benefit by using the Design tab for adding input tables, performing joins, and filtering data before you customize the generated code.
Before you unlock the code, you must perform the following steps:
  1. On the Outputs tab, specify the information for the output table, including the table name, location, and library. If you do not specify the table name or the table name is already in use, then you will not be able to save the data query.
  2. (Optional) Specify the following optional settings, if needed:
    • On the Properties tab, select Unique values to determine whether the DISTINCT keyword is included in the generated PROC SQL statement. After you unlock the code, Unique values cannot be selected to include the keyword.
    • On the Properties tab, select Append data to enable you to use the generated SAS statements for appending data to the output table.
    • On the Outputs tab, select Use a staging table and specify the library for the staging table.
  3. Save the data query by clicking the Save button. When you save the data query, the metadata for the table is registered. If you do not save the query before unlocking the code, you will receive empty columns when you run the query.

Table and Column Metadata

After unlocking the code and saving it, the columns in the output table are removed from metadata. This is because the data builder uses the columns selected on the Design tab to create column metadata, and those column selections are no longer available after you unlock the view on the Code tab.
When you run the unlocked data query, the column metadata is registered as part of running the code. However, the columns might not be visible in the data builder immediately because the table metadata (without any columns) is cached in the application.
If you did not save the query at least one time before unlocking the code, you will receive empty columns when you run the query. Make sure that you save the query before you unlock the code.

Input and Output Libraries

When you unlock the code for manual editing, you must specify the libraries to use for your tables. You can do this with LIBNAME statements. If you dragged and dropped the tables onto the workspace before you unlocked the code for manual editing, then the LIBNAME statements for the tables are automatically included.

Validate Custom Code

If you entered SAS statements in the Preprocess or Postprocess view, then those statements are not validated when you click the Validate query button.
If you unlock the code in the All Code view, then the Validate query button is disabled. You cannot validate customized code.
Last updated: January 8, 2019