Using Output Parameters

Output parameters enable stored processes to return SAS macro variables upon successful execution, and to pass one or more values back to the client. Output parameters are used mainly with SAS BI Web Services and with stored processes that are called using the Stored Process Java API.
Output parameters are defined as part of the stored process metadata. Metadata for output parameters includes the following information: name, type, label, and an optional description. The name of the output parameter is the name of the SAS macro variable that is associated with the output parameter. The label specifies the output parameter name that is displayed to the user. The output parameter can be any of the following types: Date, Double, Integer, Time, TimeStamp, or String.
Recommended formats for each output parameter type are as follows:
Formats for Output Parameters
Output Parameter Type
Format
Date
DATEw.
Double
Ew.
Integer
11.0
Note: Integer values can range from -2,147,483,648 to 2,147,483,647.
Time
TIMEw.d
Timestamp
DATETIMEw.d
String
No format needed.
For more information about any of these formats, see SAS Formats and Informats: Reference.
You can use the PUTN function to specify which numeric format you want the output parameter to have. The following example shows how to set the format for a timestamp type output parameter:
*  Input value from the prompt; 
%let timestamp1 = 17OCT1991:14:45:32; 

*  Format SAS timestamp value; 
%let TimestampOut1 = %sysfunc(putn("&timestamp1"dt, DATETIME.)); 

%put TimestampOut1 parameter is &TimeStampOut1;
The following result is written to the SAS log:
TimestampOut1 parameter is 17OCT91:14:45:32
The following example shows how to set the format for a time type output parameter:
*  Input value from the prompt; 
%let time1 = 19:35; 

*  Format SAS time value; 
%let TimeOut1 = %sysfunc(putn("&time1"t, TIME8.));  

%put TimeOut1 parameter is &TimeOut1;
The following result is written to the SAS log:
TimeOut1 parameter is 19:35:00
The following example shows how to set the format for a date type output parameter:
*  Input value from the prompt;  
%let date1 = 5Dec07; 

*  Format SAS time value; 
%let DateOut1 = %sysfunc(putn("&date1"d, DATE9.)); 

%put DateOut1 parameter is &DateOut1;
The following result is written to the SAS log:
DateOut1 parameter is 05DEC2007