BookmarkSubscribeRSS Feed

[SAS 프로그래밍 고수 백승민] [날짜] INPUT 함수를 사용하여서 문자형 시간 데이터를 시간 데이터로 변경

Started ‎06-11-2020 by
Modified ‎06-11-2020 by
Views 215

* 질문 : http://cafe.daum.net/statsas/B3m/14496 

 

* 참고 : http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169696.htm;

* ISO 8601 : http://ko.wikipedia.org/wiki/ISO_8601;

* INPUT 함수 : http://statwith.pe.kr/SAS/1.FUNCTION/F0207.htm;

 

DATA BACK;

INPUT VAR $4.;

CARDS;

0021

2100

1735

0135

1006

;

 

* INPUT 함수 처리 : 문자형 자료를 수치형 자료로 변경;

* HHMMSS로 0021를 00시 21분으로 처리 못함. 

* 이를 처리하기 위하여 ISO 8601 B8601TM INFORMAT을 사용하여처리.;

* ISO 8601은 국제 표준화 기구(ISO)에서 제정한 날짜와 시간의 표기에 관한 국제 표준 규격;

DATA BACK1;

     FORMAT VAR1 VAR2 var3 HHMM5.;

 SET BACK;

     VAR1 = INPUT(VAR,HHMMSS4.);

     VAR2 = INPUT(VAR,B8601TM.);

     var3 = HMS(substr(VAR,1,2), substr(VAR,3,2), 00);

RUN;

Version history
Last update:
‎06-11-2020 10:23 PM
Updated by:
Contributors

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Article Labels
Article Tags