Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /****************************************************************************
- * Job: JOB_STG_DIM_CONTRATO A561KEHC.BU0000YL *
- * Description: *
- * *
- * Metadata Server: dlcuzcoora1.mctp.corp *
- * Port: 8561 *
- * Location: /User Folders/Emanuel Giannattasio/SPRINT_91/CAM1819 *
- * *
- * Server: SASApp A561KEHC.AT000002 *
- * *
- * Source Tables: Dim_Contrato - OLAP.Dim_Contrato A561KEHC.BH000013 *
- * Dim_Cliente - OLAP.Dim_Cliente A561KEHC.BH000020 *
- * Target Table: STG_DIM_CONTRATO - A561KEHC.BH000015 *
- * CM_STAGE.STG_DIM_CONTRATO *
- * *
- * Generated on: miércoles 26 de septiembre de 2018 14h'26 ART *
- * Generated by: sasdemo@saspw *
- * Version: SAS Data Integration Studio 4.901 *
- ****************************************************************************/
- /* Generate the process id for job */
- %put Process ID: &SYSJOBID.;
- /* General macro variables */
- %let jobID = %quote(A561KEHC.BU0000YL);
- %let etls_jobName = %nrquote(JOB_STG_DIM_CONTRATO);
- %let etls_userID = %nrquote(sasdemo@saspw);
- /* Setup to capture return codes */
- %global job_rc trans_rc sqlrc;
- %let sysrc = 0;
- %let job_rc = 0;
- %let trans_rc = 0;
- %let sqlrc = 0;
- %global etls_stepStartTime;
- /* initialize syserr to 0 */
- data _null_; run;
- %macro rcSet(error);
- %if (&error. gt &trans_rc.) %then
- %let trans_rc = &error.;
- %if (&error. gt &job_rc.) %then
- %let job_rc = &error.;
- %mend rcSet;
- %macro rcSetDS(error);
- if &error. gt input(symget('trans_rc'),12.) then
- call symput('trans_rc',trim(left(put(&error.,12.))));
- if &error. gt input(symget('job_rc'),12.) then
- call symput('job_rc',trim(left(put(&error.,12.))));
- %mend rcSetDS;
- /* Create metadata macro variables */
- %let IOMServer = %nrquote(SASApp);
- %let metaPort = %nrquote(8561);
- %let metaServer = %nrquote(dlcuzcoora1.mctp.corp);
- /* Setup for capturing job status */
- %let etls_startTime = %sysfunc(datetime(),datetime.);
- %let etls_recordsBefore = 0;
- %let etls_recordsAfter = 0;
- %let etls_lib = 0;
- %let etls_table = 0;
- %global etls_debug;
- %macro etls_setDebug;
- %if %str(&etls_debug.) ne 0 %then
- OPTIONS MPRINT%str(;);
- %mend;
- %etls_setDebug;
- /*---- Start of Pre-Process Code ----*/
- /*LIBNAME OLAP SQLSVR Datasrc=SAS SCHEMA=dbo USER=USERSAS PASSWORD="{SAS002}1D4896162487EAF8" ;*/
- %validarFechaOlap(and);
- data fechas;
- fecha_inicio=intnx('day',date(),-90,'beginning');
- run;
- proc sql noprint;
- select fecha_inicio format=ddmmyy10. into :fecha_inicio from fechas;
- proc sql noprint;
- select fecha_key into :fecha_ini from olap.dim_fecha where dia = "&fecha_inicio.";
- /*---- End of Pre-Process Code ----*/
- %rcSet(&syserr.);
- %rcSet(&sqlrc.);
- /*==========================================================================*
- * Step: Join A561KEHC.BW0001KI *
- * Transform: Join *
- * Description: *
- * *
- * Source Tables: Dim_Contrato - OLAP.Dim_Contrato A561KEHC.BH000013 *
- * Dim_Cliente - OLAP.Dim_Cliente A561KEHC.BH000020 *
- * Target Table: Join - work.WFM6STLY A561KEHC.BX0001AY *
- *==========================================================================*/
- %let transformID = %quote(A561KEHC.BW0001KI);
- %let trans_rc = 0;
- %let etls_stepStartTime = %sysfunc(datetime(), datetime20.);
- %let etls_recnt = -1;
- %global etls_sql_pushDown;
- %let etls_sql_pushDown = -1;
- option DBIDIRECTEXEC;
- proc datasets lib = work nolist nowarn memtype = (data view);
- delete WFM6STLY;
- quit;
- /*
- Path_Inc es una variable macro definida en appserver_autoexec.sas;
- /sasFiles/MA/bin/Parametros/sas
- */
- %include "&Path_Inc./ctrlTablaVacia.sas";
- %ctrlTablaVacia(OLAP, Dim_Contrato);
- proc sql;
- create view work.WFM6STLY as
- select
- Dim_Contrato.Contrato length = 8
- format = 11.
- informat = 11.
- label = 'Contrato',
- Dim_Contrato.Contrato_Key length = 8
- format = 11.
- informat = 11.
- label = 'Contrato_Key',
- Dim_Contrato.Estado_Parque_Key length = 8
- format = 4.
- informat = 4.
- label = 'Estado_Parque_Key',
- Dim_Contrato.Estado_Suspension_Key length = 8
- format = 6.
- informat = 6.
- label = 'Estado_Suspension_Key',
- Dim_Contrato.Fecha_Activacion_Key length = 8
- format = 6.
- informat = 6.
- label = 'Fecha_Activacion_Key',
- Dim_Contrato.Linea length = 8
- format = 20.
- informat = 20.
- label = 'Linea',
- Dim_Contrato.Localidad_Anterior_Key length = 8
- format = 11.
- informat = 11.
- label = 'Localidad_Anterior_Key',
- Dim_Contrato.Localidad_Key length = 8
- format = 11.
- informat = 11.
- label = 'Localidad_Key',
- Dim_Contrato.Segmento_CRM_Key length = 8
- format = 6.
- informat = 6.
- label = 'Segmento_CRM_Key',
- Dim_Contrato.Segmento_Key length = 8
- format = 6.
- informat = 6.
- label = 'Segmento_Key',
- Dim_Cliente.Ciclo_Key length = 8
- format = 4.
- informat = 4.
- label = 'Ciclo_Key',
- Dim_Contrato.Estado_Plataforma_Key length = 8
- format = 4.
- informat = 4.
- label = 'Estado_Plataforma_Key',
- Dim_Contrato.Antiguedad_Key length = 8
- format = 6.
- informat = 6.
- label = 'Antiguedad_Key',
- Dim_Contrato.Equipo_Utilizado_Key length = 8
- format = 11.
- informat = 11.
- label = 'Equipo_Utilizado_Key',
- Dim_Contrato.Plan_Key length = 8
- format = 11.
- informat = 11.
- label = 'Plan_Key',
- Dim_Contrato.Cliente_Key length = 8
- format = 11.
- informat = 11.
- label = 'Cliente_Key',
- Dim_Contrato.Estado_Legajo_Key length = 8
- format = 6.
- informat = 6.
- label = 'Estado_Legajo_Key',
- Dim_Contrato.Fecha_Baja_Key length = 8
- format = 6.
- informat = 6.
- label = 'Fecha_Baja_Key',
- Dim_Cliente.Fecha_Key length = 8
- format = 6.
- informat = 6.
- label = 'Fecha_Key',
- Dim_Cliente.Estado_Morosidad_Key length = 8
- format = 4.
- informat = 4.
- label = 'Estado_Morosidad_Key',
- Dim_Cliente.Perfil_Financiero_Key length = 8
- format = 6.
- informat = 6.
- label = 'Perfil_Financiero_Key',
- Dim_Cliente.Estado_Cuenta_Key length = 8
- format = 6.
- informat = 6.
- label = 'Estado_Cuenta_Key',
- Dim_Cliente.Tipo_Debito_Key length = 8
- format = 4.
- informat = 4.
- label = 'Tipo_Debito_Key',
- Dim_Cliente.Entidad_Debito_Key length = 8
- format = 6.
- informat = 6.
- label = 'Entidad_Debito_Key',
- Dim_Cliente.Cliente length = 8
- format = 11.
- informat = 11.
- label = 'Cliente',
- Dim_Cliente.Tipo_Documento_Key length = 8
- format = 4.
- informat = 4.
- label = 'Tipo_Documento_Key',
- Dim_Cliente.Numero_Documento length = 8
- format = 20.
- informat = 20.
- label = 'Numero_Documento',
- Dim_Cliente.Numero_Documento_Editado length = 20
- format = $20.
- informat = $20.
- label = 'Numero_Documento_Editado',
- Dim_Cliente.Documento_Key length = 8
- format = 20.
- informat = 20.
- label = 'Documento_Key',
- Dim_Cliente.Localidad_Facturacion_Key length = 8
- format = 11.
- informat = 11.
- label = 'Localidad_Facturacion_Key',
- Dim_Cliente.Cuenta length = 25
- format = $25.
- informat = $25.
- label = 'Cuenta',
- Dim_Cliente.Cliente_Padre_Key length = 8
- format = 11.
- informat = 11.
- label = 'Cliente_Padre_Key',
- Dim_Contrato.Fecha_Cambio_Titularidad_Key length = 8
- format = 6.
- informat = 6.
- label = 'Fecha_Cambio_Titularidad_Key',
- Dim_Contrato.Fecha_Dormant_Key length = 8
- format = 6.
- informat = 6.
- label = 'Fecha_Dormant_Key',
- Dim_Contrato.Fecha_Suspension_Key length = 8
- format = 6.
- informat = 6.
- label = 'Fecha_Suspension_Key',
- Dim_Contrato.Estado_Contrato_Key length = 8
- format = 6.
- informat = 6.
- label = 'Estado_Contrato_Key',
- Dim_Contrato.Estado_Dormant_Key length = 8
- format = 4.
- informat = 4.
- label = 'Estado_Dormant_Key',
- Dim_Contrato.Tecnologia_Key length = 8
- format = 4.
- informat = 4.
- label = 'Tecnologia_Key',
- Dim_Contrato.Equipo_Key length = 8
- format = 6.
- informat = 6.
- label = 'Equipo_Key',
- Dim_Contrato.Blister_Key length = 8
- format = 4.
- informat = 4.
- label = 'Blister_Key',
- Dim_Contrato.Punto_Venta_Key length = 8
- format = 11.
- informat = 11.
- label = 'Punto_Venta_Key',
- Dim_Contrato.Representante_Key length = 8
- format = 11.
- informat = 11.
- label = 'Representante_Key',
- Dim_Contrato.Promocion_Key length = 8
- format = 11.
- informat = 11.
- label = 'Promocion_Key',
- Dim_Contrato.Condicion_Equipo_Key length = 8
- format = 6.
- informat = 6.
- label = 'Condicion_Equipo_Key',
- Dim_Contrato.Origen_Equipo_Key length = 8
- format = 6.
- informat = 6.
- label = 'Origen_Equipo_Key',
- Dim_Contrato.Canal_Venta_Key length = 8
- format = 6.
- informat = 6.
- label = 'Canal_Venta_Key',
- Dim_Contrato.Motivo_Baja_Key length = 8
- format = 6.
- informat = 6.
- label = 'Motivo_Baja_Key',
- Dim_Contrato.Fecha_Actualizacion_Key length = 8
- format = 11.
- informat = 11.
- label = 'Fecha_Actualizacion_Key',
- Dim_Contrato.Plan_Inicial_Key length = 8
- format = 11.
- informat = 11.
- label = 'Plan_Inicial_Key',
- Dim_Contrato.IMSI length = 15
- format = $15.
- informat = $15.
- label = 'IMSI',
- Dim_Contrato.IMEI length = 14
- format = $14.
- informat = $14.
- label = 'IMEI',
- Dim_Contrato.CNC_Numeracion_Key length = 8
- format = 11.
- informat = 11.
- label = 'CNC_Numeracion_Key',
- Dim_Contrato.Plan_Anterior_Key length = 8
- format = 11.
- informat = 11.
- label = 'Plan_Anterior_Key',
- Dim_Contrato.Tecnologia_Anterior_Key length = 8
- format = 4.
- informat = 4.
- label = 'Tecnologia_Anterior_Key',
- Dim_Contrato.Estado_Contrato_Anterior_Key length = 8
- format = 6.
- informat = 6.
- label = 'Estado_Contrato_Anterior_Key',
- Dim_Contrato.Estado_Dormant_Anterior_Key length = 8
- format = 4.
- informat = 4.
- label = 'Estado_Dormant_Anterior_Key',
- Dim_Contrato.Estado_Plataforma_Anterior_Key length = 8
- format = 4.
- informat = 4.
- label = 'Estado_Plataforma_Anterior_Key',
- Dim_Contrato.Segmento_CRM_Anterior_Key length = 8
- format = 6.
- informat = 6.
- label = 'Segmento_CRM_Anterior_Key',
- Dim_Contrato.Estado_Parque_Anterior_Key length = 8
- format = 4.
- informat = 4.
- label = 'Estado_Parque_Anterior_Key',
- Dim_Contrato.Cliente_Responsable_Key length = 8
- format = 11.
- informat = 11.
- label = 'Cliente_Responsable_Key',
- Dim_Contrato.Fecha_Estado_Legajo_Key length = 8
- format = 6.
- informat = 6.
- label = 'Fecha_Estado_Legajo_Key'
- from
- OLAP.Dim_Contrato as Dim_Contrato inner join
- OLAP.Dim_Cliente as Dim_Cliente
- on
- (
- Dim_Contrato.Fecha_Key = Dim_Cliente.Fecha_Key
- and Dim_Contrato.Cliente_Key = Dim_Cliente.Cliente_Key
- )
- where
- (Dim_Contrato.Fecha_Baja_Key = -2000
- or Dim_Contrato.Fecha_Baja_Key >= &fecha_ini.)
- and Dim_Contrato.Linea <> 0
- ;
- quit;
- /*==========================================================================*
- *Modificacion llamado a crtlDepurador*
- *==========================================================================*/
- proc sql;
- create table tmp_count as
- select count(*) as cantidad
- from work.WFM6STLY;
- quit;
- proc sql noprint;
- select cantidad into :cantidad from tmp_count;
- quit;
- /*
- Path_Inc es una variable macro definida en appserver_autoexec.sas;
- /sasFiles/MA/bin/Parametros/sas
- */
- %include "&Path_Inc./crtlDepurador.sas";
- %crtlDepurador(JOB_DIM_CONTRATO,&cantidad.)
- %global etls_sql_pushDown;
- %let etls_sql_pushDown = &sys_sql_ip_all.;
- /*==========================================================================*/
- %rcSet(&sqlrc.);
- /** Step end Join **/
- /*==========================================================================*
- * Step: Extract A561KEHC.BW0001KJ *
- * Transform: Extract *
- * Description: *
- * *
- * Source Table: Join - work.WFM6STLY A561KEHC.BX0001AY *
- * Target Table: STG_DIM_CONTRATO - A561KEHC.BH000015 *
- * CM_STAGE.STG_DIM_CONTRATO *
- *==========================================================================*/
- %let transformID = %quote(A561KEHC.BW0001KJ);
- %let trans_rc = 0;
- %let etls_stepStartTime = %sysfunc(datetime(), datetime20.);
- %let etls_recnt = -1;
- %let SYSLAST = %nrquote(work.WFM6STLY);
- %global etls_sql_pushDown;
- %let etls_sql_pushDown = -1;
- option DBIDIRECTEXEC;
- /*---- Map the columns ----*/
- proc datasets lib = CM_STAGE nolist nowarn memtype = (data view);
- delete STG_DIM_CONTRATO;
- quit;
- %put %str(NOTE: Mapping columns ...);
- proc sql;
- create table CM_STAGE.STG_DIM_CONTRATO as
- select
- Contrato,
- Contrato_Key,
- Estado_Parque_Key,
- Estado_Suspension_Key,
- Fecha_Activacion_Key,
- Linea,
- Localidad_Anterior_Key,
- Localidad_Key,
- Segmento_CRM_Key,
- Segmento_Key,
- Ciclo_Key,
- Estado_Plataforma_Key,
- Antiguedad_Key,
- Equipo_Utilizado_Key,
- Plan_Key,
- Cliente_Key,
- Estado_Legajo_Key,
- Fecha_Baja_Key
- from &SYSLAST.
- ;
- quit;
- %let SYSLAST = CM_STAGE.STG_DIM_CONTRATO;
- %global etls_sql_pushDown;
- %let etls_sql_pushDown = &sys_sql_ip_all.;
- %rcSet(&sqlrc.);
- /** Step end Extract **/
- /*---- Start of Post-Process Code ----*/
- %actualizarFechaOlap;
- /*---- End of Post-Process Code ----*/
- %rcSet(&syserr.);
- %rcSet(&sqlrc.);
- %let etls_endTime = %sysfunc(datetime(),datetime.);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement