25.10.2016 Views

SAP HANA Predictive Analysis Library (PAL)

sap_hana_predictive_analysis_library_pal_en

sap_hana_predictive_analysis_library_pal_en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DELETE FROM <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS;<br />

CALL DM_<strong>PAL</strong>.<strong>PAL</strong>_DISTRRANDOM(<strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB, <strong>PAL</strong>_CONTROL_TAB,<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS) with overview;<br />

--SELECT * FROM <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS;<br />

-- calculate cash flow ----<br />

DROP TABLE <strong>PAL</strong>_CASHFLOW_YEAR4;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_CASHFLOW_YEAR4(ID INTEGER,CASH DOUBLE);<br />

INSERT INTO <strong>PAL</strong>_CASHFLOW_YEAR4 SELECT <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE.ID,<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE.RANDOM<br />

- <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_COSTS.RANDOM -<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS.RANDOM<br />

FROM <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE left<br />

join <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_COSTS on<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE.ID=<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_COSTS.ID left<br />

join<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS on<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE.ID=<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS.ID;<br />

--SELECT * from <strong>PAL</strong>_CASHFLOW_YEAR4;<br />

----------------------------<br />

-------YEAR 5 --------------<br />

--Product revenue----<br />

DELETE FROM <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB;<br />

INSERT INTO <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB VALUES ('DISTRIBUTIONNAME', 'NORMAL');<br />

INSERT INTO <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB VALUES ('MEAN', '30000');<br />

INSERT INTO <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB VALUES ('VARIANCE', '9000000');<br />

DELETE FROM <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE;<br />

CALL DM_<strong>PAL</strong>.<strong>PAL</strong>_DISTRRANDOM(<strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB, <strong>PAL</strong>_CONTROL_TAB,<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE) with overview;<br />

--SELECT * FROM <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE;<br />

----Product Costs---------<br />

DELETE FROM <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB;<br />

INSERT INTO <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB VALUES ('DISTRIBUTIONNAME', 'NORMAL');<br />

INSERT INTO <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB VALUES ('MEAN', '10000');<br />

INSERT INTO <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB VALUES ('VARIANCE', '562500');<br />

DELETE FROM <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_COSTS;<br />

CALL DM_<strong>PAL</strong>.<strong>PAL</strong>_DISTRRANDOM(<strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB, <strong>PAL</strong>_CONTROL_TAB,<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_COSTS) with overview;<br />

--SELECT * FROM <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_COSTS;<br />

----OVERHEADS---------<br />

DELETE FROM <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB;<br />

INSERT INTO <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB VALUES ('DISTRIBUTIONNAME',<br />

'UNIFORM');<br />

INSERT INTO <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB VALUES ('MIN', '3000');<br />

INSERT INTO <strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB VALUES ('MAX', '4000');<br />

DELETE FROM <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS;<br />

CALL DM_<strong>PAL</strong>.<strong>PAL</strong>_DISTRRANDOM(<strong>PAL</strong>_DISTRRANDOM_DISTRPARAM_TAB, <strong>PAL</strong>_CONTROL_TAB,<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS) with overview;<br />

--SELECT * FROM <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS;<br />

-- calculate cash flow ----<br />

DROP TABLE <strong>PAL</strong>_CASHFLOW_YEAR5;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_CASHFLOW_YEAR5(ID INTEGER,CASH DOUBLE);<br />

INSERT INTO <strong>PAL</strong>_CASHFLOW_YEAR5 SELECT <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE.ID,<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE.RANDOM<br />

- <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_COSTS.RANDOM -<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS.RANDOM<br />

FROM <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE left<br />

join <strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_COSTS on<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE.ID=<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_COSTS.ID left<br />

join<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS on<br />

<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_REVENUE.ID=<strong>PAL</strong>_DISTRRANDOM_RESULT_TAB_OVERHEADS.ID;<br />

--SELECT * from <strong>PAL</strong>_CASHFLOW_YEAR5;<br />

Step 2<br />

Calculate the net present value of the investment by the following equation for each sampling.<br />

562 P U B L I C<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Predictive</strong> <strong>Analysis</strong> <strong>Library</strong> (<strong>PAL</strong>)<br />

End-to-End Scenarios

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!