Configuration of SAS Forecast Server 2.1: Stored

Configuration of
SAS Forecast Server 2.1:
Stored Processes
®
®
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2008. Configuration of SAS
Forecast Server 2.1: Stored Processes. Cary, NC: SAS Institute Inc.
Configuration of SAS® Forecast Server 2.1: Stored Processes
Copyright © 2008, SAS Institute Inc., Cary, NC, USA
All rights reserved. Produced in the United States of America.
For a hard-copy book: No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written
permission of the publisher, SAS Institute Inc.
For a Web download or e-book: Your use of this publication shall be governed by the terms established by the
vendor at the time you acquire this publication.
U.S. Government Restricted Rights Notice: Use, duplication, or disclosure of this software and related
documentation by the U.S. government is subject to the Agreement with SAS Institute and the restrictions set forth
in FAR 52.227-19, Commercial Computer Software-Restricted Rights (June 1987).
SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513.
1st printing, January 2008
SAS® Publishing provides a complete selection of books and electronic products to help customers use SAS
software to its fullest potential. For more information about our e-books, e-learning products, CDs, and hard-copy
books, visit the SAS Publishing Web site at support.sas.com/pubs or call 1-800-727-3228.
SAS® and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS
Institute Inc. in the USA and other countries. ® indicates USA registration.
Other brand and product names are registered trademarks or trademarks of their respective companies.
Chapter 1
SAS Forecast Server Stored Processes:
Configuration
Contents
What Is a Stored Process? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configure SAS Forecast Server Stored Processes . . . . . . . . . . . . . . . . . .
Pre-defined Macro Variables to Use with Stored Processes . . . . . . . . . . . . .
1
1
2
What Is a Stored Process?
A stored process is a SAS program that is stored centrally on a server. A client application can
then execute the program, and can receive and process the results. Stored processes enable you
to maintain and manage code centrally, give you better control over changes, enhance security and
application integrity, and ensure that every client executes the latest version of code that is available.
Stored processes are like other SAS programs, except that they have an additional feature that
enables you to customize the program’s execution. This feature enables the invoking application to
supply parameters at the time that the stored process is invoked. For example, if you have a stored
process that analyzes monthly sales data, you could create a MONTH variable in the stored process.
At execution time, you would supply the parameter MONTH=MAY to analyze May sales data. For
more information about how to create a stored process and to invoke it in a client application, see
the stored process section of the SAS Integration Technologies: Developer’s Guide.
Configure SAS Forecast Server Stored Processes
N OTE : Before you configure any of the stored processes, it is recommended that you make a copy
of the stored process and store them in a different directory.
A SAS Forecast Server project stores information hierarchically in project directories, or folders,
depending on the server’s operating system. For an opened project, you can execute a stored process
interactively by using the information stored in the project, and by using the level and node of the
hierarchy that currently is selected.
2 F Chapter 1: SAS Forecast Server Stored Processes: Configuration
To configure a SAS Forecast Server stored process, perform the following steps:
1. Save your SAS code in the !SASROOT\ForecastStudio\Reports\Samples directory.
If the folder does not exist, then create a new folder named Samples.
2. Open SAS Management Console and connect to a metadata repository as the SAS Administrator (e.g., sasadm).
3. Expand the Stored Process Manager folder.
4. Expand the Forecast Studio folder.
5. Expand the Stored Processes folder.
6. If there is not a Samples folder, then right-click the Stored Processes folder, select New
Folder, and create a new folder named Samples.
7. Right-click the Samples folder and select New Stored Process.
8. Enter the name of your SAS program and a description (optional), and click Next.
9. Select SASMain as the SAS server. You need to add a source repository, which is a directory
where the programs can be found.
a) Click Manage.
b) Click Add.
c) Enter c:\SAS\ForecastStudio\Reports\Samples as the location, which is the
same location where you saved your .sas file, and a description (optional).
d) Click OK.
e) Click OK again.
10. Select or enter the directory where you saved your SAS code as the source repository, enter
the name of your SAS program as the source file, select Transient result package as the
output, and click Next.
11. Click Finish on the Parameter panel.
You can find your new report in SAS Forecast Server from the Forecasting ! Reports menu
option. If you have a project opened, then you can run the report.
Pre-defined Macro Variables to Use with Stored Processes
To assist you with creating stored processes, SAS provides pre-defined macro variables. These
macro variables contain information about the project as well as the location in the hierarchy that
you are viewing currently. In general, the pre-defined macro variables that are used by SAS Forecast
Server can be grouped into two categories:
Pre-defined Macro Variables to Use with Stored Processes F 3
project macro variables
interactive macro variables
You can use the project macro variables outside of SAS Forecast Server in SAS programs and stored
processes by including the &HPF_INCLUDE file. You cannot use interactive macro variables outside of SAS Forecast Server in SAS programs and stored processes unless you define these macro
variables yourself.
Interactive macro variables depend on the node of the tree (table) that currently is selected. Project
macro variables do not depend on the tree node.
N OTE : If the number of variables is very large (BY, dependent, independent, reporting, etc.), the
stored process macro variables can exceed the default maximum macro variable value length of
4096. The maximum length can be increased to 65534 by using the MVARSIZE= system option.
Table 1.1 lists the macro variables and their descriptions. You can use these macro variables in any
stored process which you create for a SAS Forecast Server project.
Table 1.1
Pre-defined Macro Variables
Name
Macro Variables for Project Information
HPF_DESC
HPF_PROJECT
HPF_PROJECT_LOCATION
HPF_PROJECT_SERVER
HPF_INCLUDE
Description
Format
Description of the Forecast Studio Project.
The name of the project.
System path to the project directory or folder.
SAS Workspace Server name.
Project include file.
This macro variable specifies the system path
and file name that contains the SAS code to
assign SAS libraries and catalogs associated
with the project.
By default, all libraries and catalogs are
assigned with Read Only access
(ACCESS=READONLY).
For example, the following SAS code
assigns project library names with Read
Only access:
%include “&HPF_INCLUDE”;
For example, the following SAS code
assigns project library names with Read and
Write access:
%let HPF_READ_ONLY = 0;
%include “&HPF_INCLUDE”;
SAS label
SAS name
System path
Host name
System file
name
Macro Variables for Project Input Data Information
HPF_INPUT_LIBNAME
SAS library reference for the input data set.
HPF_INPUT_DATASET
SAS member for the input data set.
Macro Variables for Project Variable Information
SAS name
SAS name
4 F Chapter 1: SAS Forecast Server Stored Processes: Configuration
Table 1.1
Pre-defined Macro Variables (continued)
Name
HPF_NUM_BYVARS
HPF_BYVARS
HPF_BYVAR&n
HPF_NUM_DEPVARS
HPF_DEPVARS
Description
Number of BY variables.
If there are no BY variables,
HPF_NUM_BYVARS is set to zero.
List of BY variable names.
The order of the BY variable names is the
same as specified in the project.
The macro variable is always defined; but if
there are no BY variables, HPF_BYVARS is
set to NULL.
BY variable name listed in the nt h position
of the ordered list of BY variables
(HPF_BYVARS).
The first BY variable name is stored in
HPF_BYVAR1, the second in
HPF_BYVAR2, and the last is stored in
HPF_BYVAR&HPF_NUM_BYVARS.
If there are no BY variables
(&HPF_NUM_BYVARS is zero), these
macro variables are not defined.
Number of dependent variables.
There is always at least one dependent
variable.
List of all dependent variable names.
The order of the dependent variable names is
the same as specified in the project.
HPF_DEPVAR&n
Dependent variable name listed in the nt h
position of the ordered list of dependent
variables (HPF_DEPVARS).
The first dependent variable name is stored
in HPF_DEPVAR1, the second in
HPF_DEPVAR2, and the last is stored in
HPF_DEPVAR&HPF_NUM_DEPVARS.
Since there is always at least one dependent
variable associated with a project,
HPF_DEPVAR1 is always defined.
HPF_NUM_INDEPVARS
Number of independent variables.
If there are no independent variables,
HPF_NUM_INDEPVARS is set to zero.
Format
Nonnegative
integer
List of SAS
names separated
by a single
space
SAS name
Positive integer
List of SAS
names separated
by a single
space
SAS name
Nonnegative
integer
Pre-defined Macro Variables to Use with Stored Processes F 5
Table 1.1
Pre-defined Macro Variables (continued)
Name
HPF_INDEPVARS
HPF_INDEPVAR&n
HPF_NUM_REPORTVARS
HPF_REPORTVARS
HPF_REPORTVAR&n
Description
List of all independent variable names.
The order of the independent variable names
is the same as specified in the project.
The macro variable is always defined; but if
there are no independent variables,
HPF_INDVARS is set to NULL.
Independent variable name listed in the nt h
position of the ordered list of independent
variables (HPF_INDEPVARS).
The first independent variable name is stored
in HPF_INDEPVAR1, the second in
HPF_INDEPVAR2, and the last is stored in
HPF_INDEPVAR&HPF_NUM_
INDEPVARS.
If there are no independent variables
(&HPF_NUM_INDVARS is zero), these
macro variables are not defined.
Number of reporting variables.
If there are no reporting variables, then
HPF_NUM_REPORTVARS is set to zero.
List of all reporting variable names.
The order of the reporting variable names is
the same order as specified in the project.
The macro variable is always defined; but if
there are no reporting variables, then
HPF_REPORTVARS is set to NULL.
Report variable name listed in the nt h
position of the ordered list of report variables
(HPF_REPORTVARS).
The first report variable name is stored in
HPF_REPORTVAR1, the second in
HPF_REPORTVAR2, and the last is stored
in HPF_REPORTVAR&HPF_
NUM_REPORTVARS.
If there are no reporting variables
(&HPF_NUM_REPORTVARS is zero), then
these macro variables are not defined.
Macro Variables for Project Time ID Information
HPF_TIMEID
Time ID variable name
HPF_TIMEID_FORMAT
Time ID format name
HPF_SEASONALITY
Length of the seasonal cycle
A seasonality of 1 implies no seasonality.
Format
List of SAS
names separated
by a single
space
SAS name
Nonnegative
integer
List of SAS
names separated
by a single
space
SAS name
SAS name
SAS format
name
Positive integer
6 F Chapter 1: SAS Forecast Server Stored Processes: Configuration
Table 1.1
Pre-defined Macro Variables (continued)
Name
HPF_INTERVAL
Description
Time interval name
HPF_DATASTART
Start date/date-time/time value of the project
The starting time ID value of the project
input data set
(&HPF_LIBNAME.&HPF_
DATASET).
End date/date-time/time value of the project
The ending time ID value of the project input
data set
(&HPF_LIBNAME..&HPF_DATASET).
HPF_DATAEND
Macro Variables for Project Data Options
HPF_SETMISSING
Missing value interpretation
HPF_TRIMMISS
Missing value trimming
HPF_ZEROMISS
Zero value interpretation
Macro Variables for Project Diagnostic Options
HPF_DIAGNOSE_
Intermittency threshold value
INTERMITTENT
HPF_DIAGNOSE_SEASONTEST
Seasonality significance level
Macro Variables for Project Selection Options
HPF_SELECT_CRITERION
Model selection criterion
HPF_SELECT_HOLDOUT
Holdout sample absolute size
Zero implies that the model fit is used for
selection.
HPF_SELECT_HOLDOUTPCT
Holdout sample percent size
HPF_SELECT_MINOBS_NON_MEAN
Minimum number of observations required
before a non-mean model is selected
HPF_SELECT_MINOBS_TREND
Minimum number of observations required
before a trend model is selected
Macro Variables for Project Forecast Options
HPF_LEAD
Length of the forecast horizon or lead
HPF_BACK
Number of time periods to omit
HPF_FORECAST_ALPHA
Confidence level size
Macro Variables for Project Hierarchy Information
HPF_NUM_LEVELS
Number of levels in the hierarchy
The levels of the hierarchy are numbered
from 1 (the top of the hierarchy) to
&HPF_NUM_LEVELS (the leaves of the
hierarchy).
If there is no hierarchy, then the number of
levels is 1.
Format
SAS time
interval
SAS date/
date-time/
time value
SAS date/
date-time/
time value
Positive number
P-value
Positive integer
Positive integer
Positive integer
Nonnegative
integer
Positive integer
P-value
Positive integer
Pre-defined Macro Variables to Use with Stored Processes F 7
Table 1.1
Pre-defined Macro Variables (continued)
Name
HPF_LEVEL_DATAWHERE&n
Description
Input data WHERE clause for the nt h level,
where n ranges from 1 to
&HPF_NUM_LEVELS
These WHERE clauses can be used to subset
the input data sets for each level in the
hierarchy to obtain information about the
currently selected node.
The WHERE clause at level 1 (the top) is
stored in HPF_LEVEL_DATAWHERE1, the
WHERE clause at the lowest level (the
leaves) is stored in
HPF_LEVEL_DATAWHERE&HPF_
NUM_LEVELS.
N OTE : You must unquote this macro
variable. For example,
%unquote
(&&HPF_CURRENT_DATAWHERE&n);
Format
SAS WHERE
clause
HPF_LEVEL_OUTWHERE&n
Output data WHERE clause for the nt h level
where n ranges from 1 to
&HPF_NUM_LEVELS
These WHERE clauses can be used to subset
the input data sets for each level in the
hierarchy to obtain information about the
currently selected node.
The WHERE clause at level 1 (the top) is
stored in HPF_LEVEL_OUTWHERE1, the
WHERE clause at the lowest level (the
leaves) is stored in
HPF_LEVEL_OUTWHERE&HPF_
NUM_LEVELS.
N OTE : You must unquote this macro
variable. For example,
%unquote
(&&HPF_LEVEL_OUTWHERE&n);
SAS WHERE
clause
HPF_LEVEL_RECONCILE_
DATASET&n
HPF_LEVEL_RECONCILE_
STATISTICS&n
HPF_LEVEL_RECONCILE_
SUMMARY&n
Reconciled forecast data set for the nt h level
SAS name
Reconciled statistics data set for the nt h level
SAS name
Reconciled summary data set for the nt h
level
SAS name
8 F Chapter 1: SAS Forecast Server Stored Processes: Configuration
Table 1.1
Pre-defined Macro Variables (continued)
Name
HPF_LEVEL_BYVARS&n
Description
List of BY variable names associated with
the nt h level, where n ranges from 1 to
&HPF_NUM_LEVELS
The variables names are separated by a
single space.
The BY variables at level 1 (the top) are
stored in HPF_LEVEL_BYVARS1, the BY
variables for the lowest level (the leaves) are
stored in HPF_LEVEL_BYVARS&HPF_
NUM_LEVELS.
Format
SAS name
HPF_LEVEL_LIBNAME&n
SAS library reference for the nt h level,
where n ranges from 1 to
&HPF_NUM_LEVELS
The library reference at level 1 (the top) is
stored in HPF_LEVEL_LIBNAME1, the
library reference at the lowest level (the
leaves) is stored in
HPF_LEVEL_LIBNAME&HPF_
NUM_LEVELS.
SAS
LIBNAME
HPF_LEVEL_NSERIES&n
Number of series associated with the nt h
level, where n ranges from 1 to
&HPF_NUM_LEVELS
The number of series at level 1 (the top) is
stored in HPF_LEVEL_NSERIES1, the
number of series at the lowest level (the
leaves) is stored in
HPF_LEVEL_NSERIES&HPF_
NUM_LEVELS.
Positive integer
Macro Variables for Project Event Information
HPF_EVENTS
List of all event names
HPF_EVENT_n
Name of the nt h event
HPF_NUM_EVENTS
Number of events
Macro Variables for Project Reconcile Information
HPF_RECONCILE_LEVEL
Number of the reconciliation level
The reconciliation level number ranges from
1 to &HPF_NUM_LEVELS, depending on
the level of reconciliation.
HPF_RECONCILE_BYVAR
BY variable of reconciliation level
HPF_RECONCILE_METHOD
Reconciliation method
Macro Variables for Interactive Current Level Information
SAS name
SAS name
Positive integer
Positive integer
SAS name
SAS name
Pre-defined Macro Variables to Use with Stored Processes F 9
Table 1.1
Pre-defined Macro Variables (continued)
Name
HPF_CURRENT_LEVEL
HPF_CURRENT_LIBNAME
HPF_CURRENT_LEVEL_ START
HPF_CURRENT_LEVEL_END
HPF_CURRENT_LEVEL_NSERIES
HPF_CURRENT_DATAWHERE
Description
The level number associated with the current
level.
The current level number ranges from 1 to
&HPF_NUM_LEVELS, depending on the
currently selected level of the hierarchy.
SAS library reference for the currently
selected level of the hierarchy
Start date/date-time/time value of the current
level
The starting time ID value of the input data
set for the currently selected level of the
hierarchy.
End date/date-time/time value of the current
level
The ending time ID value of the input data
set for the currently selected level of the
hierarchy.
Number of series (or nodes) associated with
the currently selected level of the hierarchy
Input data WHERE clause for the currently
selected node
This WHERE clause can be used to subset
the input data set to obtain information about
the currently selected node of the hierarchy.
N OTE : You must unquote this macro
variable. For example,
%unquote
(&HPF_CURRENT_DATAWHERE);
Format
Positive integer
SAS
LIBNAME
SAS date/
date-time/
time value
SAS date/
date-time/
time value
Positive integer
SAS WHERE
clause
HPF_CURRENT_OUTWHERE
Output data WHERE clause for the currently
selected node
This WHERE clause can be used to subset
the output data sets to obtain information
about the currently selected node.
N OTE : You must unquote this macro
variable. For example,
%unquote
(&HPF_CURRENT_OUTWHERE);
SAS WHERE
clause
HPF_NUM_CURRENT_BYVARS
Number of BY variable names for the
currently selected level of the hierarchy
Nonnegative
integer
10 F Chapter 1: SAS Forecast Server Stored Processes: Configuration
Table 1.1
Pre-defined Macro Variables (continued)
Name
HPF_CURRENT_BYVARS
Description
List of BY variable names for the currently
selected level of the hierarchy
The macro variable is always defined; but if
there are no BY variables,
HPF_CURRENT_BYVARS is set to NULL.
HPF_CURRENT_BYVARS&n
nt h BY variable name for the current level
HPF_CURRENT_DEPVAR
Dependent variable name associated with the
currently selected node of the hierarchy. This
variable is contained in the list of dependent
variables (HPF_DEPVARS).
HPF_CURRENT_SERIESSTART
Start date/date-time/time value of the current
node
The starting time ID value of the series for
the currently selected node of the hierarchy.
HPF_CURRENT_SERIESEND
End date/date-time/time value of the current
node
The ending time ID value of the series for
the currently selected node of the hierarchy.
HPF_CURRENT_HORIZON
Horizon date/date-time/time value of the
current node
The time ID value of the start of the
multi-step ahead forecast for the currently
selected node of the hierarchy.
Macro Variables for Metadata Repository Information
HPF_METADATA_HOST
Metadata server host name
HPF_METADATA_PORT
Metadata server port number
HPF_METADATA_REPNAME
Metadata repository name
Macro Variables for Other Information
HPF_READ_ONLY
Project access Read Only flag
By default, stored processes have Read Only
access with respect to the project libraries.
This macro variable changes this access to
Write.
For example, the following SAS code
assigns project library names with Read
Only access:
%include “&HPF_INCLUDE”;
For example, the following SAS code assigns
project library names with Write access:
%let HPF_READ_ONLY = 0;
%include “&HPF_INCLUDE”;
Format
List of SAS
names separated
by a single
space
SAS name
SAS name
SAS date/
date-time/
time value
SAS date/
date-time/
time value
SAS date/
date-time/
time value
Host name
Port number
Repository
name
Boolean
Pre-defined Macro Variables to Use with Stored Processes F 11
Table 1.1
Pre-defined Macro Variables (continued)
Name
HPF_DEFAULT_LOCATION
HPF_ODSDEST
Description
Default path to the system directory where
the SAS Forecast Server projects are
currently stored
Used inside a stored process to control the
output destination of ODS
By default, HPF_ODSDEST is set to
HTML, which means that the ODS output is
in HTML format. You can change this value
by adding a stored process parameter with
the macro variable name of
HPF_ODSDEST, which provides a choice at
runtime. The valid values are the following:
HTML (default)
PDF
RTF
XML
Format
System path
name
ODS
destinations
66
66
66