SAS Scalable Performance Data (SPD) Server Macro Variables


Introduction

Macro variables, known as symbolic variables, operate similarly to LIBNAME and table options. But, they have an advantage because they apply globally. That is, their value remains constant until explicitly changed.

This chapter presents reference information for SPD Server macro variables, including their purpose, default values, and when and how to use them. The variables are grouped by function or purpose of the default value. Changing the value can also change the purpose, making the variable fall into another group. 

For example, the default setting for the macro variable SPDSSADD= is NO. The SPDSSADD= macro enhances performance during data appends. Setting SPDSSADD=  to YES changes the way the variable functions.  The macro setting SPDSADD=YES ensures compatibility with the base SAS engine.  The default setting improves performance.  Changing the setting from the default improves Base SAS software compatibility. 

To set a macro variable to YES submit the following statement:

%let MACROVAR=YES;

Note:  Assignments for macro variables with YES|NO arguments must be entered in uppercase (capitalized).

When you specify table option settings, precedence matters.  If you specify a table option after you set the option in a macro variable statement, the table option setting takes precedence over the macro variable option setting.  If you specify an option using  a LIBNAME statement, then later specify an option setting through a macro variable statement, the table option setting made in the macro variable takes precedence over the over the LIBNAME statement setting.

To view the default values for the SPD Server macro variables, use the SPDSMAC command associated with PROC SPDO.  SAS displays the macro variables and their current settings. Understanding proper use of macro variables in SPD Server allows you to unleash the power of the software.


Variable for Compatibility with the Base SAS Engine

SPDSBNEQ=


Use the SPDSBNEQ= setting to specify the output order of table rows that have identical values in the BY column.

Syntax
SPDSBNEQ=YES|NO

Default: NO

Corresponding Table Option: BYNOEQUALS=

Use the following arguments:

YES
outputs rows with identical values in a BY clause in random order.
NO
outputs rows with identical values in a BY clause using the relative table position of the rows from the input table.

Description
SPDSBNEQ=NO configures the SPD Server to imitate the Base SAS engine behavior. If strict compatibility is not required, assign SPDSBNEQ=YES. Random output allows the SPD Server to create indexes and append to tables faster.

Example
Configure the SPD Server so that it output table rows as quickly as possible when processing rows that have identical values in the BY column.

%let SPDSBNEQ=YES;

Variables for Miscellaneous Functions

SPDSEOBS=

Use the SPDSEOBS= macro variable to specify the number of the last row (end observation) of a user-defined range that you want to process in a table.

Syntax
SPDSEOBS=n

Default:  The default setting of 0 processes the entire table.

Corresponding Table Option: ENDOBS=

Use the following argument:

  n
        
is the number of the end row.

Description
The SPD Server processes the entire table by default unless you specify a range of rows. You can specify a range using the macro variables SPDSSOBS= and SPDSEOBS=, or you can use the table options, STARTOBS= and ENDOBS=.

If you use the range start macro variable SPDSSOBS= without specifying an end range value using the SPDSEOBS= macro variable, SPD Server processes to the last row in the table. If you specify values for both SPDSSOBS= and SPDSEOBS= macro variables, the value of SPDSEOBS= must be greater than SPDSSOBS=.  The SPDSSOBS= and SPDSEOBS= macro variables specify ranges for table input processing as well as WHERE Clause processing.

Example
In order to create test tables, you configure the SPD Server to subset the first 100 rows of each table in your job.  Submit the macro variable statement for SPDSEOBS= at the beginning of your job.

%let SPDSEOBS=100;

SPDSSOBS=


Use the SPDSSOBS= macro variable to specify the number of the starting row (observation) in a user-defined range of a table.

Syntax
SPDSSOBS=n

Default:  The default setting of 0 processes the entire table.

Corresponding Table Option: STARTOBS=

Use the following argument:

n
     
is the number of the start row.

Description
By default, SPD Server processes entire tables unless you specify a range of rows. You can specify a range using the macro variables SPDSSOBS= and SPDSEOBS=, or you can use the table options, STARTOBS= and ENDOBS=.

If you specify the end of a user-defined range using the SPDSEOBS= macro variable, but do not implicitly specify the beginning of the range using SPDSSOBS=, SPD Server sets SPDSSOBS= to 1, or the first row in the table. If you specify values for both SPDSSOBS= and SPDSEOBS= macro variables, the value of SPDSEOBS= must be greater than SPDSSOBS=.  The SPDSSOBS= and SPDSEOBS= macro variables specify ranges for table input processing as well as WHERE Clause processing.

Example
Print the INVENTORY.OLDAUTOS table, skipping rows 1-999 and beginning with row 1000.  You should submit the SPDSSOBS= macro variable statement before the PROC PRINT statement in your job.

%let SPDSSOBS=1000;

The statement above specifies the starting row with SPDSSOBS=, but does not declare an ending row for the range using SPDSEOBS=.  When the program executes, SAS will begin printing at row 1000 and continues until the final row of the table is reached.

PROC PRINT data=inventory.oldautos;
run;

SPDSUSAV=


Use the SPDSUSAV= macro variable to specify whether to save rows with non-unique (rejected) keys to a separate SAS table.

Syntax
SPDSUSAV=YES|NO|REP

Default: NO

Affected by Table Option : SYNCADD=

Use in Conjunction with Variable : SPDSUSDS=

Corresponding Table Option : UNIQUESAVE=

Use the following arguments:

YES
writes rows with non-unique key values to a SAS table.  Use the macro variable SPDSUSDS= to reference the name of the SAS table for the rejected keys.
 
NO
non-unique key values are ignored and rejected rows are not written to a separate table.
 
REP
when updating a master table from a transaction table, where the two tables share identical variable structures, the SPDSUSAV=REP option replaces the row updated row in the master table instead of appending a row to the master table. The REP option only functions in the presence of a /UNIQUE index on the MASTER table. Otherwise, the REP setting is ignored..
 
 

Description
When performing an append operation, SPD Server does not save the rows which contain duplicate key values unless the SPDSUSAV= macro variable is set to YES. 

When SPDSUSAV= is set to YES, SPD Server creates a hidden SAS table and writes rejected rows to the table. Use the SPDSUSDS= macro variable command to view the contents of the table.  Each append operation creates a different table.

Example
Append several tables to the EMPLOYEE table, using employee number as a unique key. The appended tables should not have records with duplicate employee numbers. 

At the beginning of the job, configure SPD Server to write any rejected (identical) employee number records to a SAS table.  The macro variable SPDSUSDS= holds the name of the SAS table for the rejected keys.

%let SPDSUSAV=YES

Use a %PUT statement to display the name of the table, and then print the table.

%put Set the macro variable spdsusds to &spdsusds;

title 'Duplicate (non-unique) employee numbers found in
       EMPS';
PROC PRINT data=&spdsusds; run;

SPDSUSDS=


Use the SPDSUSDS= macro variable to reference the name of the SAS table that SPD Server creates for duplicate or rejected keys when the SPDSUSAV= macro variable is set to YES.

Syntax
SPDSUSDS=

Default: SPD Server automatically generates identifying strings for the duplicate or rejected key tables.

Use in Conjunction with Table Option: SYNCADD=

Use in Conjunction with Variable: SPDSUSAV=

Corresponding Table Option: UNIQUESAVE=

Description
When SPDSUSAV= or UNIQUESAVE= is set to YES, SPD Server creates a table to store any rows with duplicate key values encountered during an append operation. Submitting the SPDSUSDS= macro variable references the generated name for the hidden SAS table.

To obtain the name and print the table's contents, reference the variable SPDSUSDS=.

Example

%let SPDSUSAV=YES

Use a %PUT statement to display the name of the table created by SPDSUSDS= and to print out the duplicate rows.

%put Set the macro variable spdsusds to &spdsusds;

title 'Duplicate Rows Found in MYTABLE
       During the Last Data Append';
PROC PRINT data=&spdsusds; run;

SPDSVERB=


Use the SPDSVERB= macro variable to provide verbose details on all  indexes, ACL information, and other information that is associated with SPD Server tables.  

Syntax
SPDSVERB=YES|NO

Default: NO

Corresponding Table Option: VERBOSE=

Use the following arguments:

YES
requests detail information for indexes, ACLs, and other SPD Server table values.
 
NO
suppresses detail information for indexes, ACLs, and other SPD Server table values.

Example
You need information about associated indexes for the SPD Server table SUPPLY.  Configure SPD Server for verbose details at the start of your session so you can see index details. Submit the SPDSVERB= macro variable as a line in your your autoexec.sas file:

%let SPDSVERB=YES;

Submit a PROC CONTENTS request for the SUPPLY table:

PROC CONTENTS data=supply;
run;

SPDSFSAV=


Use the SPDSFSAV= macro variable to specify whether you want to retain table data if the SPD Server table creation process terminates abnormally.

Syntax
SPDSFSAV=YES|NO

Default: NO.  Normally SAS closes and deletes tables which are not properly created.

Use the following arguments:

YES
enables FORCESAVE mode and saves the table.
 
NO
default SPD Server actions delete partially completed tables.

Description
Large tables can require a long time to create. If problems such as network interruptions or disk space shortages occur during this time period, the table may not be properly created and signal an error condition. If SAS encounters such an error condition, it deletes the partially completed table.

In SPD Server you can set SPDSFSAV=YES.  Saving the partially created table can protect the time and resources invested a in long-running job. When the SPDSFSAV= macro variable is set to YES, the SPD Server LIBNAME proxy saves partially completed tables in their last state and identifies them as damaged tables.

Marking the table damaged prohibits other SAS DATA or PROC steps from accessing the table until its state of completion can be verified. After you verify or repair a table, you can clear the 'damaged' status and enable further read/update/append operations on the table. Use the PROC DATASETS REPAIR operation to remove the damaged file indicator.

Example
Configure SPD Server before you run the table creation job for a large table called ANNUAL.  If some error prevents the successful completion of the table ANNUAL, the partially completed table will be saved.

%let SPDSFSAV=YES;
DATA SPDSLIB.ANNUAL;
...
RUN;

SPDSEINT=


Use the SPDSEINT= macro to specify how SPD Server responds to network disconnects during SQL pass-through EXECUTE() statements.

Syntax
SPDSEINT=YES|NO

Default: YES

Description:
The SPD Server SQL server interrupts SQL processing by default when a network failure occurs . The interruption prematurely terminates the EXECUTE() statement. Setting SPDSEINT=NO configures the SPD Server's SQL server to continue processing until completion regardless of network disconnects.

Warning: Use the macro variable setting SPDSEINT=NO carefully! A runaway EXECUTE() statement requires a privileged system user on the server machine to kill the SPD Server SQL proxy process. This is the only way to stop the processing.


Variables for Sorts

SPDSBSRT=


Use the SPDSBSRT= macro variable to configure SPD Server's sorting behavior when it encounters a BY-clause and there is no index available.

Syntax
SPDSBSRT=YES|NO

Default: YES

Corresponding Table Option: BYSORT=

Use the following arguments:

YES
SPD Server performs a server sort when it encounters a BY clause and there is no index available.
 
NO
SPD Server does not perform a sort when it encounters a BY clause.

Description
Base SAS software requires an explicit PROC SORT statement to sort SAS data. In contrast, SPD Server sorts a table whenever it encounters a BY clause, if it determines that the table has no index.

Advantages for using SPD Server implicit sorts are discussed in detail in the Help section for Connecting to SAS Scalable Performance Data Server

Example 1
At the start of a session to run old SAS programs, you realize that you do not have time to remove the existing PROC SORT statements. These statements are present only to generate print output.

To avoid redundant Server sorts, configure SPD Server to turn off implicit sorts. Put the macro variable assignment in your autoexec.sas file so SPD Server retains the configuration for all job sessions.

%let SPDSBSRT=NO;

During the Example 1 session you decide to run a new program that has no PROC SORT statements. Instead, the new program takes advantage of SPD Server implicit sorts.

data inventory.old_autos;
   input
      year $4.
      @6 manufacturer $12.
      model $10.
      body_style $5.
      engine_liters
      @39 transmission_type $1.
      @41 exterior_color $10.
      options $10.
      mileage condition;

   datalines;

1971 Buick       Skylark   conv  5.8  A  yellow    00000001 143000 2
1982 Ford        Fiesta    hatch 1.2  M  silver    00000001  70000 3
1975 Lancia      Beta      2door 1.8  M  dk blue   00000010  80000 4
1966 Oldsmobile  Toronado  2door 7.0  A  black     11000010 110000 3
1969 Ford        Mustang   sptrf 7.1  M  red       00000111 125000 3
;

PROC PRINT data=inventory.old_autos;
   by model;

run;

When the code executes, the PRINT procedure returns an error message. What happened? SAS expected INVENTORY.OLDAUTOS to be sorted before it would generate print output. Since there is no PROC SORT statement -- and implicit sorts are still turned off -- the sort does not occur.

Example 2
Keep implicit sorts turned off for the session, but specify an implicit sort for the table INVENTORY.OLDAUTOS.

PROC PRINT data=inventory.oldautos(bysort=yes);
by model;
run;

SPDSNBIX=

Use the SPDSNBIX= macro variable to configure whether to use an index during a BY-sort.

Syntax
SPDSNBIX=YES|NO

Default: NO

Corresponding Server Parameter Option: [NO]BYINDEX

Use the following arguments:

YES
Set SPDSNBIX=YES to suppress index use during a BY-sort. If the distribution of the values in the table are not relatively sorted or clustered, using the index for the by sort can result in poor performance.
 
 
NO
Set SPDSNBIX=NO or use the default value to allow the [NO]BYINDEX server parameter option to determine whether to use an index for a by sort.

Example

%let SPDSNBIX=YES;

SPDSSTAG=


Use the SPDSSTAG= macro variable to specify whether to use non-tagged or tagged sorting for PROC SORT or BY processing.

Syntax
SPDSSTAG=YES|NO

Default: NO

Use the following arguments:

YES
performs tagged sorting.
 
NO
performs non-tagged sorting.

Description
During a non-tagged sort, SPD Server attaches the entire table column to the key field(s) to be sorted. Non-tagged sorting allows the software to deliver better performance than a tagged sort. Non-tagged sorting also requires more temporary disk space than a tagged sort.

Example
You are running low on disk space and don't know if you have enough disk overhead to accommodate the extra sort space required to support a non-tagged sort operation.

Configure SPD Server to perform a tagged sort.

%let SPDSSTAG=YES;

Variables for WHERE Clause Evaluations

SPDSTCNT=


Use the SPDSTCNT= macro variable to specify the number of threads that you want to use during WHERE Clause evaluations.

Syntax
SPDSTCNT=n

Default: The value of MAXWHTHREADS is configured by SPD Server parameters.

Used in Conjunction with the SPD Server Parameter: MAXWHTHREADS

Corresponding Table Option: THREADNUM=

Use the following argument:

n
        is the number of threads.

Description
See THREADNUM= for a description and an explanation of how SPDSTCNT= interacts with the SPD Server parameter MAXWHTHREADS.


SPDSEV1T=


Use the SPDSEV1T= macro variable to indicate whether data returned from a SPD Server WHERE Clause evaluations should be in strict row (observation) order.

The macro variables SPDSEV1T= and SPDSEV2T= work in conjunction with the SPD Server WHERE Clause planner WHINIT.

The variables SPDSEV1T= and SPDSEV2T= are identical in purpose.  You use them to specify the row order of data returned in WHERE-processing. Which variable the server exercises depends on the evaluation strategy selected by WHINIT.  The SPDSEV1T= evaluation strategy is indexed.  The SPDSEV2T= evaluation strategy is non-indexed.  Avoid using these options unless you absolutely understand the SPD Server performance tradeoffs that depend on maintaining the order of data.

If compatibility with Base SAS software is important, set both SPDSEV1T= and SPDSEV2T= to 0.  When both evaluation strategies are set to 0, SPD Server returns data in row order whether the SPDSEV1T= or the SPDSEV2T= strategy is selected.

When you use PROC SQL to perform table joins on sorted tables that use extra WHERE predicates to filter table rows, PROC SQL uses sort order information to optimize the join strategy.  Data that has been filtered by the evaluation of extra WHERE predicates returns to PROC SQL in sorted order.  SPD Server restricts parallel evaluation of WHERE predicates any time the table(s) have been sorted using PROC SORT to meet this requirement.  Sorting data in this manner can negatively impact net performance because most SAS PROCs or DATA steps do not process sorted data any faster than unsorted data..  SPD Server recommends you set the SPDSEV1T= and/or SPDSEV2T= macro variables to 2.  Setting SPDSEV1T= and/or SPDSEV2T= macro variables to 2 configures SPD Server to perform parallel WHERE Clause evaluations without regard for the sort order of the SPD Server tables.   

Note: The SPDSEV1T= and SPDSEV2T= usage discussed here does not apply to SQL statements executed via the SPD Server pass-through SQL mechanism.

Syntax
SPDSEV1T=0|1|2

Default: 1

Used in Conjunction with Indexed WHERE Clause Evaluation Strategy

Uses the following arguments:

0        
returns data in row order.
1       
may not return the data in row order.  SPD Server may override as needed to force a 0 setting if the table is sorted using PROC SORT.
2       
always forces parallel evaluation regardless of sorted order.  May not return data in row order.

Description
If SPD Server must return many rows during WHERE Clause processing, setting the variable to 0 will greatly slow performance.  Use 0 only when row order is required.  Use 2 only when you know row order is not important to the result.

Example
Configure SPD Server to send back data in row order whenever WHINIT performs an EVAL1 evaluation.

%let SPDSEV1T=0;

SPDSEV2T=


Use the SPDSEV2T=  macro variable to specify whether the data returned from WHERE Clause evaluations should be in strict row (observation) order.

The macro variables SPDSEV1T= and SPDSEV2T= work in conjunction with the SPD Server WHERE Clause planner WHINIT.

The variables SPDSEV1T= and SPDSEV2T= are identical in purpose.  You use them to specify the row order of data returned in WHERE-processing. Which variable the server exercises depends on the evaluation strategy selected by WHINIT.  The SPDSEV1T= evaluation strategy is indexed.  The SPDSEV2T= evaluation strategy is non-indexed.  Avoid using these options unless you absolutely understand the SPD Server performance tradeoffs that depend on maintaining the order of data.

If compatibility with Base SAS software is important, set both SPDSEV1T= and SPDSEV2T= to 0.  When both evaluation strategies are set to 0, SPD Server returns data in row order whether the SPDSEV1T= or the SPDSEV2T= strategy is selected.

When you use PROC SQL to perform table joins on sorted tables that use extra WHERE predicates to filter table rows, PROC SQL uses sort order information to optimize the join strategy.  Data that has been filtered by the evaluation of extra WHERE predicates returns to PROC SQL in sorted order.  SPD Server restricts parallel evaluation of WHERE predicates any time the table(s) have been sorted using PROC SORT to meet this requirement.  Sorting data in this manner can negatively impact net performance because most SAS PROCs or DATA steps do not process sorted data any faster than unsorted data..  SPD Server recommends you set the SPDSEV1T= and/or SPDSEV2T= macro variables to 2.  Setting SPDSEV1T= and/or SPDSEV2T= macro variables to 2 configures SPD Server to perform parallel WHERE Clause evaluations without regard for the sort order of the SPD Server tables.   

Note: The SPDSEV1T= and SPDSEV2T= usage discussed here does not apply to SQL statements executed via the SPD Server pass-through SQL mechanism.

Syntax
SPDSEV2T=0|1|2

Default: 1

Used in Conjunction with Non-Indexed WHERE Clause Evaluation Strategy

Use the following arguments:

0
returns data in row order.
1
may not return the data in row order.  SPD Server may override as needed to force 0 setting if the table is sorted using PROC SORT.
2
always forces parallel evaluation regardless of sorted order.  May not return the data in row order.

Description
If SPD Server must return many rows during WHERE Clause processing, setting the variable to 0 will greatly slow performance.  Use 0 only when row order is required.  Use 2 only when you know row order is not important to the result.

Example
Configure SPD Server to send back data in row order whenever WHINIT performs an EVAL2 evaluation.

%let SPDSEV2T=0;

SPDSWDEB=


Use the SPDSWDEB= macro variable to specify whether the WHERE Clause planner WHINIT, when evaluating a WHERE expression, should display a summary of the execution plan.

Syntax
SPDSWDEB=YES|NO

Default: NO

Use the following arguments:

YES
displays WHINIT's planning output.
 
NO
suppresses WHINIT's planning output.

SPDSIRAT=

Use the SPDSIRAT= macro variables to specify whether to perform segment candidate pre-evaluation when performing WHERE Clause processing with hybrid indexes.

Syntax
SPDSIRAT=0..100

Default: MAXSEGRATIO server parameter

Description:
When using hybrid indexes, WHERE-based queries pre-evaluate segments. The segments are scanned for candidates that match one or more predicates in the WHERE clause. The candidate segments that were identified during  the pre-evaluation are queried in subsequent logic to evaluate the WHERE Clause.  Eliminating the non-candidate segments from the WHERE Clause evaluation generally results in substantial performance gains.

Some queries can benefit by limiting the pre-evaluation phase. SPD Server imposes the limit based on a ratio: the number of segments that contain candidates compared to the total number of segments in the table. The reason for this is simple. If the predicate has candidates in a high percentage of the segments, the pre-evaluation work is largely wasted.

The ratio formed by dividing the number of segments that containing candidates by the number of total segments is compared to a cutoff point. If the segment ratio is greater than the value assigned to the cutoff point, the extra processing required to perform pre-evaluation outweighs any potential process savings that might be gained through the predicate pre-evaluation.  SPD Server calculates the ratio for a given predicate and compares the ratio to the SPDSIRAT= value, which acts as the cutoff point. If the calculated ratio is less than or equal to the SPDSIRAT= value, pre-evaluation is performed.  If the calculated ratio is greater than the SPDSIRAT= value, pre-evaluation is skipped and every segment is a candidate for the WHERE Clause.  

Use the global SPD Server parameter, MAXSEGRATIO to set the default cutoff value. The default MAXSEGRATIO should provide good performance. Certain specific query situations might be justification for modifying your SPDSIRAT= value.  When you modify your SPDSIRAT= value, it overrides the default value established by MAXSEGRATIO.

Example: 
Configure SPD Server to perform a pre-evaluation phase for WHERE Clause processing with hybrid indexes if the candidates are in 65% or less of the segments.

%let SPDSIRAT=65;

SPDSNIDX=


Use the SPDSNIDX= macro variable to specify whether to use the table's indexes when processing WHERE Clauses. SPDSNIDX= can also be used to disable index use for BY- order determination.

Syntax
SPDSNIDX=YES|NO

Default: NO

Corresponding Table Option: NOINDEX=

Use the following arguments:

YES
ignores indexes when processing WHERE Clauses.
 
NO
uses indexes when processing WHERE Clauses.
 

Description:
Set SPDSNIDX=YES to test the effect of indexes on performance or for specific processing. Do not use YES routinely for normal processing.


Example: 
Assume you are processing data from SPORT.MAILLIST.  There is an index for the SEX column and you want to test to determine if the index will improve performance when you use PROC PRINT processing on SPORT.MAILLIST.

You should configure SPD Server not to use the index:

data sport.maillist;
  input 
    name $ 1-20 
    address $ 21-57 
    phoneno $ 58-69 
    sex $71; 

datalines;

   Douglas, Mike 3256 Main St., Cary, NC 27511 919-444-5555 M
   Walters, Ann Marie 256 Evans Dr., Durham, NC 27707 919-324-6786 F
   Turner, Julia 709 Cedar Rd., Cary, NC 27513 919-555-9045 F
   Cashwell, Jack 567 Scott Ln., Chapel Hill, NC 27514 919-533-3845 M
   Clark, John 9 Church St., Durham, NC 27705 919-324-0390 M
   ;

PROC DATASETS lib=sport nolist;
modify maillist;
index create sex;
quit;

/*Turn on the macro variable SPDSWDEB */
/* to show that the index is not used */
/* during the table processing.       */

%let spdswdeb=YES;

%let spdsnidx=YES;

title "All Females from Current Mailing List";
PROC PRINT data=sport.maillist;
where sex="F";
run;

%let spdsnidx=NO;


SPDSWCST=


Use the SPDSWCST= macro variable to specify whether to use dynamic WHERE Clause costing.

Syntax
SPDSWCST=YES|NO

Default: NO

Corresponding Server Parameter Option: [NO]WHERECOSTING
Turns WHERE-costing on or off for an entire server.

Description:
Set SPDSWCST=YES to use dynamic WHERE Clause costing.  Disabling SPDSWCST= defaults SPD Server to using WHERE-costing with WHINIT.


Example: 

%let SPDSWCST=YES;


SPDSWSEQ=


Syntax
SPDSWSEQ=YES|NO

Default: NO

Description:
Set the SPDSWSEQ= macro variable to YES.  When set to YES, the SPDSWSEQ= macro variable overrides WHERE Clause costing and forces a global EVAL3 or EVAL4 strategy.


Example: 

%let SPDSWSEQ=YES;


Variables That Affect Disk Space

SPDSCMPF=


Use the SPDSCMPF= macro variable to specify the amount of growth space, sized in bytes, to be added to a compressed data block.

Syntax
SPDSCMPF=n

Default: 0 bytes

Use the following argument:

n
        is the number of bytes to add.

Description
Updating rows in compressed tables can increase the size of a given table block.  Additional space is required for the block to be written back to disk.  When contiguous space is not available on the hard drive, a new block fragment stores the excess, updated quantity.  Over time, the table will experience block fragmentation.

When opening compressed tables for OUTPUT or UPDATE, you can use the SPDSCMPF= macro variable to anticipate growth space for the table blocks. If you estimate correctly, you can greatly reduce block fragmentation in the table.

Note:  SPD Server table metadata does not retain compression buffer or growth space settings.


SPDSDCMP=


Use the SPDSDCMP= macro variable to compress SPD Server tables that are stored on disk.

Syntax
SPDSDCMP=YES|NO

Default: NO

Use in Conjunction with Table Option: IOBLOCKSIZE=

Corresponding Table Option: COMPRESS=

Use the following arguments:

YES
performs the run-length compression algorithm SPDSRLLC.
 
NO
performs no table compression.
 

Description
When you set the SPDSDCMP= macro variable to YES, SPD Server compresses newly created tables by 'blocks' according to the algorithm specified. To control the amount of compression, use the table option IOBLOCKSIZE= to specify the number of rows that you want to store in the block. For a complete discussion, refer to IOBLOCKSIZE=.

Note:  Once a compressed table is created, you cannot change its block size. To resize the block, you must PROC COPY the table to a new table, setting IOBLOCKSIZE= to the new block size for the output table.

Example
Prior to creating huge tables, you want to conserve disk space. Specify compression, and the default algorithm SPDSRLLC, at the beginning of your job.

%let SPDSDCMP=YES;

SPDSIASY=


Use the SPDSIASY= macro variable to specify whether to create indexes in parallel when creating multiple indexes on an SPD Server table.

Syntax
SPDSIASY=YES|NO

Default: NO

Corresponding Table Option : ASYNCINDEX=

Use the following arguments:

YES
creates the indexes in parallel.
NO
creates one index at a time.

Description
You use the macro variable SPDSIASY= to choose between parallel and sequential index creation on SPD Server tables with more than one index.  One advantage of creating multiple indexes in parallel is speed.  The speed enhancements that can be achieved with parallel indexes are not free.  Parallel indexes require significantly more disk space for working storage. The default SPD Server setting for the SPDSIASY= macro variable is set to NO, in order to avoid exhausting the available work storage space.

However, if you have adequate disk space to support parallel sorts, it is strongly recommended that you override the default SPDSIASY=NO setting and assign SPDSIASY=YES.  You can substantially increase performance -- indexes that take hours to build complete much faster.

How many indexes should you create in parallel? The answer depends on several factors, such as the number of CPUs in the SMP configuration and available storage space needed for index key sorting.  

When managing disk space on your SPD Server, remember that grouping index create statements can minimize the number of table scans that SPD Server performs, but it also affects disk space consumption. There is an inverse relationship between the table scan frequency and disk space requirements.  A minimal number of table scans requires more auxiliary disk space; a maximum number of table scans requires less auxiliary disk space.

Example
Your perform batch processing from midnight to 6:00 a.m. All of your processing must be completed before start of the next work day. One frequently-repeated batch job creates large indexes on a table, and usually takes several hours to complete. Configure SPD Server to create indexes in parallel to reduce the processing time.

%let SPDSIASY=YES;
proc datasets lib=spds;
   modify a;
   index create x;
   index create y;
   modify a;
   index create comp=(x y) comp2=(y x);
   quit;

In the example above, the X and Y indexes will be created in parallel. After creating X and Y indexes, SPD Server creates the COMP and COMP2 indexes in parallel. In this example, two table scans are required:  one table scan for the X and Y indexes, and a second table scan for the COMP and COMP2 indexes.


SPDSSIZE=


Use the SPDSSIZE= macro variable to specify the size of an SPD Server table partition.

Syntax
SPDSSIZE=n

Default: 16 Megabytes

Corresponding Table Option: PARTSIZE=

Affected by LIBNAME option: DATAPATH=

Use the following argument:

n
is the size of the partition in Megabytes.

Description
Use this SPDSSIZE= macro variable option to improve performance of WHERE Clause evaluation on non-indexed table columns.

Splitting the data portion of a server table at fixed-sized intervals allows SPD Server to introduce a high degree of scalability for non-indexed WHERE Clause evaluation. This is because SPD Server launches threads in parallel and can evaluate different partitions of the table without file access or thread contention. The speed enhancement comes at the cost of disk usage.  The more data table splits you create, the more you increase the number of files, which are required to store the rows of the table.

Scalability limits on the SPDSSIZE= macro variable ultimately depend on how you structure the DATAPATH=  option in your LIBNAME statement. The configuration of the DATAPATH= file systems across striped volumes is important. You should spread each individual volume's striping configuration across multiple disk controllers/SCSI channels in the disk storage array. Your configuration goal, at the hardware level, should be to maximize parallelism when performing data retrieval.

The SPDSSIZE= specification is also limited by MINPARTSIZE=, an SPD Server parameter maintained by the SPD Server administrator. MINPARTSIZE= ensures that an over-zealous SAS user cannot arbitrarily create small partitions, thereby generating an excessive number of physical files. The default for MINPARTSIZE= is 16 Mbytes. 

Note: The SPDSSIZE= value for a table cannot be changed after the table is created. To change the SPDSSIZE=, you must PROC COPY the table and use a different SPDSSIZE= (or PARTSIZE=) option setting on the new (output) table.

For an example using the table option, see PARTSIZE=.

%let SPDSSIZE=32;

Variables To Enhance Performance

SPDSNETP=


Use the SPDSNETP= macro variable to size buffers in server memory for the network data packet.

Syntax
SPDSNETP=size-of-packet

Default: 32K

Corresponding Table Option: NETPACKSIZE=

Use the argument:

size-of-packet
is the size (integer) in bytes of the network packet.

Description
When sizing the buffer for data packet transfer between SPD Server and your SAS client machine, the packet must be greater than or equal in size to one table row.  See NETPACKSIZE=  for more information.

Example
Despite recent upgrades to your network connections, you are experiencing significant pauses when the SPD Server transfers data. You want to resize the data packet to send three rows at a time for a more continuous data flow.

Specify a buffer size in server memory that is three times the row size (6144 bytes.) Submit your SPDSNETP= macro variable statement at the top of your job.

%let SPDSNETP=18432;

SPDSSADD=


Use the SPDSSADD= macro variable to specify whether SPD Server appends tables by transferring a single row at a time synchronously, or by transferring multiple rows asynchronously (block row appends).

Syntax
SPDSSADD=YES|NO

Default: NO

Related Table Option: SYNCADD=

Use the following arguments:

YES
applies a single row at a time during an append operation. This behavior imitates the Base SAS engine.
 
NO
appends multiple rows at a time 

Description
SPDSSADD=YES slows performance. Use this argument only if you require strict compatibility with Base SAS software when processing a table. For a complete discussion, refer to SYNCADD=.


SPDSSYRD=


Use the SPDSSYRD= macro variable to specify whether SPD Server should perform asynchronous data streaming when reading a table.

Syntax
SPDSSYRD=YES|NO

Default: NO

Related Table Option: SYNCREAD=

Use the following arguments:

YES   
enables asynchronous data streaming.
 
NO    
disables asynchronous data streaming.

Description Use SPDSSYRD=YES only with a MODIFY statement. If you use it with any other processing operation, you slow performance.


SPDSAUNQ=


Use the SPDSAUNQ= macro variable setting to specify whether to abort an append to a table if the table has a unique index and the append would violate the index uniqueness.

Syntax
SPDSAUNQ=YES|NO

Default: NO

Description: Use SPDSAUNQ=YES macro variable to improve append performance to a table with unique indexes.  If uniqueness is not maintained, the append is aborted and the table is returned to its state prior to the append. In such an instance, you can scrub the table to remove non-unique values and re-do the append with the macro variable SPDSAUNQ= set to YES.  The other alternative is to simply re-do the append with the macro variable SPDSAUNQ= set to NO.

If SPDSAUNQ=NO, the SPD Server will enforce uniqueness at the expense of appending unique indexes in observation order one row at a time. If uniqueness is not maintained for any given row, that row is discarded from the append.


Variables for a Client and a Server Running on the Same UNIX Machine

SPDSCOMP=
specifies to compress the data when sending a data packet through the network.

Syntax
SPDSCOMP=YES|NO

Default: NO