full-path-to-pkglibdir/SAS on
the whole database array (master and all segments), where full-path-to-pkglibdir is
the path that was defined during installation.
full-path-to-pkglibdir/SAS directory
on all nodes, where full-path-to-pkglibdir is the path that
was defined during installation.
full-path-to-pkglibdir/SAS directory,
the publishing macros use the database, schema, and model name as
the object filename to avoid potential naming conflicts.
modelname_EM_outputvarname
proc sql noerrorstop; connect to greenplm (<connection options>); execute (create table scoretab ( ID integer , EM_SEGMENT float , EM_EVENTPROBABILITY float , EM_PROBABILITY float , EM_CLASSIFICATION varchar (32) ) distributed by (id) ) by greenplm; execute ( insert into scoretab select id, function prefix_EM_SEGMENT ( comma-delimited input column list ) as "EM_ SEGMENT", function prefix_EM_EVENTPROBABILITY ( comma-delimited input column list ) as "EM_EVENTPROBABILITY", function prefix_EM_PROBABILITY ( comma-delimited input column list ) as "EM_PROBABILITY" cast(function prefix_EM_CLASSIFICATION ( comma-delimited input column list ) as varchar(32)) as "EM_CLASSIFICATION", from scoring_input_table order by id ) by greenplm; quit;
psql -h hostname -d databasename -U userid select proname from pg_catalog.pg_proc f, pg_catalog.pg_namespace s where f.pronamespace=s.oid and upper(s.nspname)='SCHEMA';
mymodel.
proc sql noerrorstop; connect to greenplm (user=username pw=password dsn= dsnname); select * from connection to greenplm (select proname from pg_catalog.pg_proc f, pg_catalog.pg_namespace s where f.pronamespace=s.oid and upper(s.nspname)='SCHEMA'); disconnect from greenplm; quit;
allmush1_intab that
is populated with a unique integer from 1 to n. n is
the number of rows in the table.
allmush1.
drop table allmush1_outtab;
create table allmush1_outtab(
id integer
,"EM_CLASSIFICATION" varchar(33)
,"EM_EVENTPROBABILITY" float
,"EM_PROBABILITY" float
);
insert into allmush1_outtab(
id
,"EM_CLASSIFICATION"
,"EM_EVENTPROBABILITY"
,"EM_PROBABILITY"
)
select id,
allmush1_em_classification("BRUISES"
,"CAPCOLOR"
,"GILLCOLO"
,"GILLSIZE"
,"HABITAT"
,"ODOR"
,"POPULAT"
,"RINGNUMB"
,"RINGTYPE"
,"SPOREPC"
,"STALKCBR"
,"STALKROO"
,"STALKSAR"
,"STALKSHA"
,"VEILCOLO")
as "EM_CLASSIFICATION",
allmush1_em_eventprobability("BRUISES"
,"CAPCOLOR"
,"GILLCOLO"
,"GILLSIZE"
,"HABITAT"
,"ODOR"
,"POPULAT"
,"RINGNUMB"
,"RINGTYPE"
,"SPOREPC"
,"STALKCBR"
,"STALKROO"
,"STALKSAR"
,"STALKSHA"
,"VEILCOLO")
as "EM_EVENTPROBABILITY",
allmush1_em_probability("BRUISES"
,"CAPCOLOR"
,"GILLCOLO"
,"GILLSIZE"
,"HABITAT"
,"ODOR"
,"POPULAT"
,"RINGNUMB"
,"RINGTYPE"
,"SPOREPC"
,"STALKCBR"
,"STALKROO"
,"STALKSAR"
,"STALKSHA"
,"VEILCOLO")
as "EM_PROBABILITY"
from allmush1_intab ;
%let indconn = user=user1 password=open1 dsn=green6 schema=myschema; %indgp_publish_model(dir=C:\SASIN\baseball1, modelname=baseball1, outdir=C:\test);
CREATE FUNCTION baseball1_EM_eventprobablility ( "CR_ATBAT" float, "CR_BB" float, "CR_HITS" float, "CR_HOME" float, "CR_RBI" float, "CR_RUNS" float, "DIVISION" varchar(31), "LEAGUE" varchar(31), "NO_ASSTS" float, "NO_ATBAT" float, "NO_BB" float, "NO_ERROR" float, "NO_HITS" float, "NO_HOME" float, "NO_OUTS" float, "NO_RBI" float, "NO_RUNS" float, "YR_MAJOR" float ) RETURNS varchar(33) AS '/usr/local/greenplum-db-3.3.4.0/lib/postgresql/SAS/ sample_dbitest_homeeq_5.so', 'homeeq_5_em_classification'
select baseball1_EM_eventprobability ( "CR_ATBAT", "CR_BB", "CR_HITS", "CR_HOME", "CR_RBI", "CR_RUNS", "DIVISION", "LEAGUE", "NO_ASSTS", "NO_ATBAT", "NO_BB", "NO_ERROR", "NO_HITS", "NO_HOME", "NO_OUTS" ) as homeRunProb from MLBGP;