SPDSBSRT Macro Variable

Configures SPD Server's sorting behavior when it encounters a BY clause and there is no index available.

Valid in: SPD Server
Default: YES
Restriction: Assignments for macro variables with character input (for example, YES | NO | BINARY arguments) must be entered in uppercase (capitalized).
Interaction: Corresponding table option is BYSORT=.

Syntax

SPDSBSRT=YES | NO

Required 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.

Details

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.

Example

At the start of a session to run old converted 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 the server to turn off implicit sorts. Put the macro variable assignment in your autoexec.sas file so that the server retains the configuration for all job sessions.
%let SPDSBSRT=NO; 
During this server session, you decide to run a new program that has no PROC SORT statements. Instead, the new program takes advantage of the server implicit sorts.
libname inventory sasspds "conversion_area" server=samson.5105 
user="siteusr1" password="secret";

data inventory.old_autos;
   infile datalines delimiter=',';
   input
     year $ 
     manufacturer $ 
     model $ 
     body_style $ 
     engine_liters 
     transmission_type $ 
     exterior_color $ 
     options
     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
;
run;

title Old Autos Table with SPDSBSRT=NO;
proc print data=inventory.old_autos; 
by model;
run; 
When the code executes, the PRINT procedure returns the following error message because SAS expected Inventory.OldAutos to be sorted before it would generate print output.
ERROR: Data set TEMPDATA.OLD_AUTOS is not sorted in ascending sequence. 
The current BY group has model = Skylark and the next BY group has model = Fiesta.
Since there is no PROC SORT statement—and implicit sorts are still turned off, the sort does not occur.
Keep implicit sorts turned off for the session, but specify an implicit sort for the table Inventory.Old_Autos by using the BYSORT= table option:
proc print data=inventory.old_autos(bysort=yes);
 by model;
 run;

See Also

SPD Server table options:
Last updated: February 8, 2017