Help us understand the problem. What is going on with this article?

【SAS】yyyymmddhhmmss形式の値のSAS日時値への変換

More than 1 year has passed since last update.
data sample ;
    val_num  =  20180102030405 ;
    val_char = "20180102030405";
run ;

data sample2 ;
    set sample ;

    /* num to sas datetime */
    format val_date datetime20.;
    val_date = input(put(val_num, 14.), B8601DN.);

    /* char to sas datetime */
    date  = input(substr(val_char,1,8), yymmdd8.);
    hour  = input(put(input(substr(val_char, 9,2), 4.),z4.),4.);
    min   = input(put(input(substr(val_char,11,2), 4.),z4.),4.);
    sec   = input(put(input(substr(val_char,13,2), 4.),z4.),4.);

    format val_date2 datetime20.;
    val_date2 = dhms(date,hour,min,sec);

run ;
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away