This topic describes the general requirements for getting source data into SAS Visual Forecasting. For further information about time series data, see Understanding Time Series Data.
SAS Visual Forecasting projects require input data that is in time seriesan aggregation of transactional data into specified time intervals and sorted according to unique combinations of the default attributes (BY variables) format. Each observation or row in the table should be using a SAS date or datetime format.
Some time series data is equally spaced. That is, successive observations are a fixed time interval apart, and the data can be described by a single interval, such as daily, every three weeks, or twice a month. You might already have this time series data, or you might have time-stamped data at irregular intervals. You can use the accumulationeither of two processes that are used to convert a time series. (1) Accumulation converts a time series that has no fixed interval into a time series that does have a fixed interval (such as hourly or monthly). (2) Accumulation converts a time series that has a fixed interval into a time series with a lower frequency time interval (such as hourly into daily). Accumulation combines data within the same time interval into a summary value for that time period. options in SAS Visual Forecasting to convert the time-stamped data into a time series.
Your time series data must meet the following requirements:
Often a data source
might have the date or date and time in character format. For example,
consider a variable with the name Sale_Date with
this construction:
ddd, yyyy mmm dt hh:mm
An example of an observation
in this format is “Mon, 2017 May 8 8:08”.
To convert this character
string into a SAS date, you would need to use some SAS functions in
a SAS DATA step. The following functions extract the year, month,
and date portions of the Sale_Date variable.
The TRIM function concatenates them into a single string that can
be read into a new variable, Project_Date,
using the SAS date9. informat.
Year = substrn(Sale_Date,6,4); /* 1 */
Month = substrn(Sale_Date,11,3); /* 2 */
Date = substrn(Sale_Date,15,2); /* 3 */
Datechar = trim(Date)||trim(Month)||trim(Year); /* 4 */
Project_Date = input( Datechar , date9.); /* 5 */
Drop Year Month Date Datechar; /* 6 */
Format Project_Date date9.; /* 7 */
Extract the year starting at the sixth position.
Extract the month starting at the 11th position.
Extract the date starting at the 15th position.
Trim trailing spaces from each
new variable, concatenate the three variables into ddmmmyyyy format.
Read in date string as SAS date9. informat.
Drop temporary variables from the final data set.
Set date format for time variable.
Using the code in this
example, the string Mon, 2017 May 8 8:08 is
converted to the SAS numeric date of 20947. Use the FORMAT statement
to format the variable so that SAS Visual Forecasting will properly detect the data when you create a project.
SAS administrators can also use SAS Data Studio to convert string data to a SAS date or datetime format.
There are some strings that are used by SAS Visual Forecasting that can cause errors when they match the name of variables in the project data set. See Reserved Variable Names for a complete list so that you can ensure that you do not have any variable names that might cause conflicts.