Date: Mon, 4 Sep 2000 09:43:55 +0100
Reply-To: Ahmed.AL-ATTAR.-.Sun.ENTERPRISE.SERVICES.INFORMATION.RESOURCES.DATA@CRONKITE.CC.UGA.EDU
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ahmed.AL-ATTAR.-.Sun.ENTERPRISE.SERVICES.INFORMATION.RESOURCES.DATA@CRONKITE.CC.UGA.EDU
Organization: Sun Microsystems
Subject: Re: Customising HOLAP (V8)
Content-Type: text/plain; charset=us-ascii
aratcliffe@cix.compulink.co.uk wrote:
>
> I need to develop a HOLAP model that supports a number of distinct
> customisations. Does anybody have any help (or encouragement!) to offer
> please?
>
> Specifically, my most pressing need is to be able to apply different
> formulae to computed columns, depending upon the chosen level in a
> specific dimension.
>
> For instance, if I have variables in my data named A, B, and C; and if I
> have a dimension named TIME with levels of YEAR, MONTH, and DAY; then I
> might want to create a computed column named XYZ whose value is A+B when
> TIME==YEAR, B+C when TIME=MONTH, and A+C when TIME==DAY.
>
> Today I will begin to look at what methods and options are available to
> me. Any help or advice would be gratefully appreciated.
>
> -Andrew
> ============================================================
> Andrew Ratcliffe ---- Ratcliffe Technical Services Limited
> SAS Institute Registered Partner
> Invited Speaker, SUGI 2000 (Indianapolis, USA)
> Office: +44 (0) 1322-525672
> Mobile: +44 (0) 7714-719206, (SMS email: aratcliffe@sms.genie.co.uk)
> Fax: +44 (0) 870-050-9662
> Web site: http://www.ratcliffe.demon.co.uk
> ============================================================
Hi Andy,
I have not seen any replies to your question yet, so here is what I can
offer.
1. Add the XYZ variable to your base (nway) data set with the value of
(A+C) assuming DAY is the last level of your TIME Dimension/Hierarchy.
2. Override the _get_data_ Method of your MDDB Model (HOLAP/Normal EIS)
to change the value of XYZ at run time when needed.
the code should look something like this (v6 version, should be
applicable).
POSTINIT:
Method;
call super(_self_ , '_postinit_');
call send
(_self_,'_set_instance_method_','_get_data_',screenname(),'getdata','override');
Return;
EndMethod;
GETDATA:
Method gddvcid 8 numcols 8;
call super(_self_,'_get_data_',gddvcid,numcols);
call send (gddvcid,'_set_index_',numcols);
/* Get information about currewnt cell */
row_l = makelist();
col_l = makelist();
class_address_l = makelist();
call send (_self_,'get_row_', row_l);
call send (_self_,'get_column_', col_l);
call send (_self_,'get_class_from_address_', row_l, col_l,
class_address_l);
/* Custom Calculate when needed */
if (searchc(class_address_l,'XYZ')) then
do;
rc = setnitemc(class_address_l, 'B','_ANLSYS_');
call send (_self_, '_get_values_', class_address_l,b_val);
if (nameditem(class_address_l,'YEAR')) then
do;
rc = setnitemc(class_address_l, 'A', '_ANLSYS_');
call send (_self_, '_get_values_', class_address_l,a_val);
new_val = b_val + a_val;
link SET_VAL;
end;
else if (nameditem(class_address_l,'MONTH')) then
do;
rc = setnitemc(class_address_l, 'C','_ANLSYS_');
call send (_self_, '_get_values_', class_address_l,c_val);
new_val = b_val + c_val;
link SET_VAL;
end;
end;
Return;
EndMethod;
SET_VAL:
call send (gddvcid,'_set_index_',numcols);
call send (gddvcid, '_set_test_', put(new_val,best.));
Return;
------------------------------------------------------------
The above scl should give good start & understanding of what methods you
should looking at. I have used this technique for most of my SAS/EIS
Customised Value calculations.
Good luck,
Ahmed
|