Example: dental hygienist

using eg effectively - Stratia

using SAS Enterprise Guide EffectivelyWho Does What Where ?Now What ?EG Default BehaviourEG Default SetupEG SASUSER EG ProfilesEG ProfilesEG AUTOEXEC --- kindaEG Who Does What Where ? different libraries different databases millions of rows SY tomorrow !EG Who Does What Where ? same library same database candidate for pass-throughWhat is Pass-Through ? SAS Access engines for RDBMS eg. Teradata, Oracle, ODBC essentially APIs to communicate with the DB explicit pass-through explicit pass-throughoSAS program connects to DBoSQL is passed through to DB SQL must be native to DB implicit pass-throughoSAS decidesand takes care of it for youExplicit Pass-Through open a program window in EGproc sql;connect toteradata ( user=&user pass="&pass"server= create tablepp_sum_cubeasselect* fromconnection to teradataselect* fromconnection to teradata( , m.))

What is Pass-Through ? • SAS Access “engines” for RDBMS • eg. Teradata, Oracle, ODBC • essentially APIs to communicate with the DB • explicit pass-through

Tags:

  Using, Effectively, Using eg effectively

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of using eg effectively - Stratia

1 using SAS Enterprise Guide EffectivelyWho Does What Where ?Now What ?EG Default BehaviourEG Default SetupEG SASUSER EG ProfilesEG ProfilesEG AUTOEXEC --- kindaEG Who Does What Where ? different libraries different databases millions of rows SY tomorrow !EG Who Does What Where ? same library same database candidate for pass-throughWhat is Pass-Through ? SAS Access engines for RDBMS eg. Teradata, Oracle, ODBC essentially APIs to communicate with the DB explicit pass-through explicit pass-throughoSAS program connects to DBoSQL is passed through to DB SQL must be native to DB implicit pass-throughoSAS decidesand takes care of it for youExplicit Pass-Through open a program window in EGproc sql;connect toteradata ( user=&user pass="&pass"server= create tablepp_sum_cubeasselect* fromconnection to teradataselect* fromconnection to teradata( , m.))

2 * mleft = ( '2012-03-01', '2012-03-02')order , );quit;Implicit Pass-Through You write SAS SAS interprets your code and it writes Teradata if possible .. In Database processingoSAS Procedures oSAS formatsImplicit Pass-Through libnamemitddata teradata user=&user pass="&pass"server=&server sql_functions=all;proc sql;selectsegment_tier_0, count(*) bysegment_tier_0;quit; SAS LIBNAME statement Teradata engine SAS SQL summary query runs entirely in Teradataosmall result set returned to SASI mplicit Pass-Through libnamemitddata teradata user=&user pass="&pass"server=&server sql_functions=all;proc freqdata= ;tablessegment_tier_0 /missing nopercent;run;514 proc freq data = ;515 tables segment_tier_0 /missing nopercent ;516 run.

3 NOTE: SQL generation will be used to construct frequency and crosstabulation Pass-Through Uh proc sql;selectadj_type, adj_reason, count(*) (adj_reason,1,3) = 'M2M'wheresubstr(adj_reason,1,3) = 'M2M'andintck('month',eff_dt,exp_dt) > 1group byadj_type, adj_reasonorder byadj_type, adj_reason;quit; runs forevvvvvvvvvverImplicit Pass-Through Uh SUBSTR and INTCK are SAS SQL_Functions = ALL finite list SUBSTR is there SUBSTR is there not INTCK what did SAS do ? better than you might imagineoptionssastrace=',,,d'sastraceloc =saslog nostsuffix;Implicit Pass-Through Uh SAS_SQL: Unable to convert the query to a DBMS specific SQL statement due to an ENGINE: SQL statement was not passed to the DBMS, SAS will do the : trqacol- No casting.

4 Raw row size=66, Casted size=74, CAST_OVERHEAD_MAXPERCENT=20%TERADATA_8: Prepared: on connection 12 SELECT "ADJ_TYPE","ADJ_REASON","EFF_DT","EXP_DT " FROM mi_data."BM_D_DA_Adjustments" WHERE ( (SUBSTR("ADJ_REASON", 1, 3) = 'M2M' ) )TERADATA_9: Executed: on connection 12 SELECT "ADJ_TYPE","ADJ_REASON","EFF_DT","EXP_DT " FROM mi_data."BM_D_DA_Adjustments" WHERE ( (SUBSTR("ADJ_REASON", 1, 3) = 'M2M' ) )TERADATA: trget -rows to fetch: 30 TERADATA: trforc: COMMIT WORKI mplicit Pass-Through CaveatDue to incompatibility in date and time functions between Teradata and SAS, Teradata might not process them correctly.

5 Check your results to determine whether these Check your results to determine whether these functions are working as expected how to be certain ?oexplicit pass-throughImplicit Pass-Through Ummmm Oracle DBotwo schemasBMLAPPOBMLREF SAS will happily run in Oracle turns SQL into Oracle query turns SQL into Oracle query much happinessImplicit Pass-Through Ummmm Teradata DBotwo schemasMI_DATAMI_STAGE 15,000 rows left joined to 120,000,000o576 amps !??! 48 minutes Pass-Through NOT !TERADATA_7: Prepared: on connection 6 SELECT * FROM mi_data."BM_D_SOC_Price_Plan ERROR: This SQL statement will not be passed to the DBMS for processing because it involves a join across librefs with different connection connection : trqacol- Casting decimals.

6 Raw row size=38, Casted size=38, CAST_OVERHEAD_MAXPERCENT=20%TERADATA_8: Prepared: on connection 4 SELECT "OLD_PP_SOC_CD","NEW_PP_SOC_CD",CAST("SE RVICE_ACTIVITY_KEY" AS FLOAT),"PERIOD_DT",CAST("SERVICE_ACTIVIT Y_KEY_PREV" AS FLOAT) FROM mi_stage."STG_SC_PP_MIGRATION" NOTE: PROCEDURE SQL used (Total process time):real time 48 cpu time 30 cpu time 6 Pass-Through Joyselect* connection to teradata ( , left = = = = = 0);NOTE: PROCEDURE SQL used (Total process time):real time secondsuser cpu time secondssystem cpu time secondsTemporary Tables intermediate resultsosubsetting exerciseodeep dive analysis need historical data for these 10,000 subscribers need historical data for these 10,000 subscribers1.

7 Pull subscriber history down to SAS, join2. where subscriber_no in ( 123 , 345 , 567 x 10K )3. Push 10,000 subscriber numbers upodo the join in DBopull only what you need downominimize slow data transfersTemporary Tables Oracle global temp tables Teradata volatile tables exist for the duration of the sessionolike SAS WORK datasetsolike SAS WORK datasets requiresoLIBNAME engineoexplicit pass-thru EXECUTE ( DDL statement ) by teradata;oimplicit pass-thru to load subsetoexplicit pass-thru for final resultTemporary Tableslibnametd_volt teradata server="&server"user=&user password="&pass"dbmstemp=yes connection=globaldbcommit=0; proc sql.

8 Connecttoteradata( server="&server"connecttoteradata( server="&server"user=&user password="&pass"connection=global mode=teradata ); /* create an empty volatile table */execute( create multiset volatile table test_vol .. ( .. columns .. ) ) byteradata; quit; Temporary Tables/* Put rows into the volatile table via the libname -if lots of records, additional options necessary, fastload*/proc sql;insert ( obs = 100);quit;Temporary Tables/* Execute pass-thru query to join Teradata table to volatile table */proc sql;connect toteradata (server="&server"user=&user password="&pass"connection=global); password="&pass"connection=global); create tablesas_datastet_of_resultsasselect* fromconnection to teradata (selects.)

9 * s,test_vol = );quit;Conclusion do stuff where it makes senseouse power of DBosummarize, subset, sort in DB not all implicit pass-thru is not all implicit pass-thru is ouse option SASTRACE use EXPLAIN ContactHarry 905-282 -3476


Related search queries