SAS中的Netezza格式

SAS中的Netezza格式,sas,netezza,Sas,Netezza,我在Netezza运行SAS格式时出错。我在下面代码的开头添加了格式。然而,在Netezza的那些人却不起作用。如果可能,您是否可以帮助查看PROC SQL部分的where语句中的两个put语句?提前谢谢 data antib; set 'P:\HSE\SPARC\SPARC Study\Docs\sparc_ndc_final_05202013.sas7bdat'; if ndc ~=''; start=NDC; label='Y'; type='C'; fmtname

我在Netezza运行SAS格式时出错。我在下面代码的开头添加了格式。然而,在Netezza的那些人却不起作用。如果可能,您是否可以帮助查看PROC SQL部分的where语句中的两个put语句?提前谢谢

data antib;
  set 'P:\HSE\SPARC\SPARC Study\Docs\sparc_ndc_final_05202013.sas7bdat';
  if ndc ~='';
  start=NDC;
  label='Y';
  type='C';
  fmtname='antib';
run;

proc sort data=antib nodupkey;
  by ndc;
run;

proc format cntlin=antib;run;


data stdyfmt(keep=start label fmtname);
  set pharm.pulllist (where=(flag='study'));
  start=sub_num;
  label='in';
  fmtname='$stdy';
run;
proc sort nodup;by start;run;
proc format cntlin=stdyfmt;run;


libname sparc "/bcbsuser/hse/jfan0001/SPARC";

%let cov_start='01Jan2008';
%let cov_end='31Dec2008';

data _null_; 
 call symput('start',trim(left(&cov_start.d -'31DEC1983'd)));
 call symput('end',trim(left(&cov_end.d -'31DEC1983'd)));
run;    


%let cov_start = '01-01-2008';
%let cov_end = '12-31-2008';

LIBNAME DW NETEZZA UID=jfan0001
               PWD=xxxxxxxx
               SERVER=bsnet01z
         database=PDWAPPRP
         preserve_tab_names=yes
         connection=global;

proc sql noprint ; 
 connect to netezza  (user=jfan0001 pwd=xxxxxxxx SERVER=bsnet01z            database=PDWAPPRP  connection=global autocommit=yes); 
 execute( Create temporary table PHARM_STDY_DW as 
      select distinct  
      D.MEM_NUM , D.SUB_NUM , D.MEM_BIRTH_DT, D.MEM_GENDER,
            A.PRESCRIPT_NUM     , 
            A.PRESCRIB_NPI   ,
            A.NUM_REFILLS      ,
            A.incurred_dt_key ,
            B.CLM_NDC    ,
            C.MDDB_TC_CLASS_CD  ,
            A.METRIC_QUANTITY   ,
            A.DAYS_SUPPLY       , 
            A.PRESCRIB_DEA_NUM      ,

        FROM 
            V_PHARM_SERVICE             A,  
        V_PHACLM_DRUG               B,
        V_MDDB_DRUG                 C,
        V_CLAIM_MEMBER_PROFILE      D,
            V_INCURRED_DATE             E

        WHERE
        PUT(D.SUB_NUM, $stdy.) = 'in'        and  /*problem for this statement*/
        PUT(B.CLM_NDC, $antib.) = 'Y'       and /*problem for this statement too*/
        A.curr_clm_ind ='Y'                and      
        A.MEM_PROF_KEY = D.MEM_PROF_KEY         and
        A.PHACLM_DRUG_KEY = B.PHACLM_DRUG_KEY   and
        A.MDDB_DRUG_KEY = C.MDDB_DRUG_key       and
        A.INCURRED_DT_KEY = E.INCURRED_DT_KEY   and
        E.INCURRED_DT_DAY between &cov_start and &cov_end
   ) by netezza;  


/* bulkunload table from netezza to ADM as SAS dataset */
     create table SPARC.PHARM_STDY_DW_08 as
     select * from  DW.PHARM_STDY_DW
       (bulkunload=YES BL_DELIMITER='|' bl_options='logdir "."');
  disconnect from netezza;
quit;

您正在将SAS代码放入直通会话中。您需要将其作为Netezza语法编写(passthrough实际上是将该字符串代码发送到Netezza,而无需对其执行任何操作并说“给您,请运行此命令并返回给我”),或者将这些PUT语句放在传输数据的步骤中。您可以在第二步(作为“select*from DW…”的一部分)中执行此操作,因为这是SAS语法,而不是passthrough


在任何情况下,您都可以使用LIBNAME而不是PASSTHROUGH作为第二个select(跳过第一个)的一部分执行这些连接;不管怎样,SAS都可能会将此信息传递回Netezza。我想先试一试。

这是Netezza的格式问题代码

proc sql   noprint;
  connect to netezza  (user=mxxxx pwd=xxxx SERVER=bsnet01z database=PDWAPPRP  connection=global autocommit=yes); 

execute ( create temporary table STDY
                 ( SUB_NUM char(13) )) by netezza;
execute ( create temporary table ANTIB
                 ( NDC char(11) )) by netezza;


insert into dw.STDY (bulkload=YES   bl_options='logdir "."')
            select SUB_NUM from pulllist     /* list of SUB_NUM, no "in" or "other"*/ 
             where flag='study';

insert into dw.ANTIB (bulkload=YES   bl_options='logdir "."')
          select NDC from sparc_ndc     /*   list of CLM_NDC, no "Y" or "other";*/
             where ndc ~='';


execute( Create temporary table PHARM_STDY_DW as 
            Select distinct  
            D.MEM_NUM , D.SUB_NUM , D.MEM_BIRTH_DT, D.MEM_GENDER,
            A.PRESCRIPT_NUM     , 
            A.PRESCRIB_NPI ,
            A.NUM_REFILLS       ,
            A.incurred_dt_key ,
            B.CLM_NDC  ,
            C.MDDB_TC_CLASS_CD  ,
            A.METRIC_QUANTITY  ,
            A.DAYS_SUPPLY   , 
            A.PRESCRIB_DEA_NUM      

        FROM 
        V_PHARM_SERVICE             A,  
        V_PHACLM_DRUG               B,
        V_MDDB_DRUG                 C,
        V_CLAIM_MEMBER_PROFILE      D,
        V_INCURRED_DATE             E,
        STDY,
        ANTIB

        WHERE
        D.SUB_NUM=STDY.SUB_NUM                  AND
        B.CLM_NDC=ANTIB.NDC                     AND
        A.curr_clm_ind ='Y'                     and
        A.MEM_PROF_KEY = D.MEM_PROF_KEY         and
        A.PHACLM_DRUG_KEY = B.PHACLM_DRUG_KEY   and
        A.MDDB_DRUG_KEY = C.MDDB_DRUG_key       and
        A.INCURRED_DT_KEY = E.INCURRED_DT_KEY   and
        E.INCURRED_DT_DAY between &cov_start and &cov_end 
       ) by netezza;                   

/* bulkunload table from netezza to ADM as SAS dataset */
     create table SPARC.PHARM_STDY_DW_08 as
     select * from  DW.PHARM_STDY_DW
       (bulkunload=YES BL_DELIMITER='|' bl_options='logdir "."');

    disconnect from netezza;
quit;