使用SAS读取由句点分隔的Julian日期

时间:2014-08-04 21:00:10

标签: date sas julian

我正在使用SAS 9.2尝试从IDCAMS实用程序报告中读取数据,该报告列出了有关z / OS主机数据集的信息。日期的格式为yyyy.jjj,其中yyyy是四位数年份,jjj是一年中的Julian日期。期间是问题,因为标准SAS INFORMATS不喜欢它。我怎么读这样的约会?

示例代码:

DATA ALL smflist (KEEP=DSNAME volser) ;         
LENGTH dsname $ 44. volser $ 6. createdt 8.;   
INFILE SYSPRINT LENGTH=LEN;                     
input @ "NONVSAM ------- " dsname;             
input @ "CREATION--------" createdt JULIAN8.;   
input @ "VOLSER------------" volser;           

示例输出包括INFILE SYSPRINT :( Col 54具有创建日期)

NOTE: Invalid data for createdt in line 282 54-61.                               
NONVSAM ------- SYSP.LPAR.SMFOTHR.ROLLING.G3563V00                               
     IN-CAT --- USR.UCAT.ALIASP                                                 
     HISTORY                                                                     
       DATASET-OWNER-----(NULL)     CREATION--------2014.174                     
       RELEASE----------------2     EXPIRATION------0000.000                     
       ACCOUNT-INFO-----------------------------------(NULL)                     
       STATUS------------ACTIVE                                                 
     SMSDATA                                                                     
       STORAGECLASS ------SCPNV     MANAGEMENTCLASS-MCPNVGD2                     
       DATACLASS ---------DCSMF     LBACKUP ---XXXX.XXX.XXXX                     
     VOLUMES                                                                     
       VOLSER------------MIGRAT     DEVTYPE------X'78048081'     FSEQN---------- 
     ASSOCIATIONS                                                               
       GDG------SYSP.LPAR.SMFOTHR.ROLLING                                       
     ATTRIBUTES                                                                 

1 个答案:

答案 0 :(得分:1)

此代码处理了它......

  DATA smflist (KEEP=dsname createdt volser) ;               
  LENGTH dsname $ 44. volser $ 6. dummy $ 8. createdt 7.;   
  FORMAT CREATEDT MMDDYY10.;                                 
  INFILE SYSPRINT LENGTH=LEN;                               
  input @ "NONVSAM ------- " dsname;                         
  input @ "CREATION--------" dummy;                         
  dummy = prxchange('s/(\d{4}).(\d{3})/\1\2/', -1, dummy);   
  createdt = input(dummy,JULIAN7.);                         
  input @ "VOLSER------------" volser;