You are on page 1of 3

3.

3 Solutions 3-23

1. Creating a Forecasting Data Source


a. Open the browser and sign in to SAS Viya.
b. Open the VA2-Practice3.1 plan in the Courses/YVA285/Advanced/Practices folder.
1) In the upper left corner, click (Show list of applications) and select Prepare Data.
SAS Data Studio appears.
2) Click Open Plan.
3) Navigate to the Courses/YVA285/Advanced/Practices folder.
4) Double-click the VA2-Practice3.1 data plan to open it.
c. View the source table properties and answer the question.

1) In the left pane, click (Properties for the source table) to show details about the
source table.

2) Answer the question:


How many columns are in the source table?
Answer: Nine columns

Copyright © 2020, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-24 Lesson 3 Restructuring Data for Forecasting

d. Append the MVAINJURIES00 data source to the source table (MVAINJURIES90).

1) In the left pane, click (Transforms).


2) In the Multi-input Transforms group, double-click Append to add the transform to the
plan.
3) In the workspace, next to the Append table field, click Browse.
a) In the Choose Data window, at the top of the window, click Data Sources.
b) Double-click the CAS server.
c) Double-click the library.
d) Scroll through the list and select MVAINJURIES00.sashdat.
Details about the table appear on the right side of the window.

e) In the upper right corner of the window, click (Load into memory).
f ) When the load is complete, at the bottom of the window, click OK to add the data
source to the plan.
The Append transform should resemble the following:

4) In the upper right corner of the workspace, click Run to execute the append.
e. Answer the following question:
How many columns are in the MVAINJURIES00 table?
Answer: Nine columns

Copyright © 2020, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.3 Solutions 3-25

f. Add a new column (DVRatio) to the result table that computes the ratio of Drivers to
Vehicles.

1) In the left pane, click (Transforms), if necessary.


2) In the Custom Transforms group, double-click Calculated column to add the transform to
the plan.
3) In the Expression field, enter Drivers/Vehicles.
Note: The ‘Column name’n syntax is not required because the column names do not
contain spaces.
4) Below the Expression field, click Create new column.
5) In the Create new column field, enter DVRatio.
6) Click Options for new columns.
a) In the Options for New Columns window, for the Name of new column field, verify
that DVRatio is specified.
b) For the Type field, select Double.
c) For the Length field, verify that 8 is specified.
d) In the Label field, enter DV Ratio.

e) Click OK to close the Options for New Columns window.


7) In the upper right corner of the workspace, click Run to create the new column.
The DVRatio column is added to the Table view.

g. Save the plan.

Copyright © 2020, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.

You might also like