본문 바로가기

자격증/SAS BASE

Chapter 13. SAS Date, Time, ane Datetime Values.

Q.  SAS date values are the number of days since which date?  (January 1, 1960)

 

 

 

 

Q. Which is an advantage of storing dates and times as SAS numeric date and time values?

  • They can be used in calculations like other numeric values.
  • In addition to tracking time intervals, SAS date and time values can be used in calculation like other numeric values.
  • This lets you calculation values that involve dates much more easily than in other programming languages.

 

 

 

Q. SAS does not auomatically make adjustments for daylight saving time, but it does make adjustments for which one of the following.   (leap years)

  • 일광 절약 시간제 (Daylight saving time, 써머타임) : 여름철에 표준시보다 1시간 시계를 앞당겨 놓는 제도. 일을 일찍 시작하고 일찍 잠에 들어 등화를 절약하고, 햇빛을 장시간 쬐면서 건강을 증진한다는 근거로 주장되었다. 
  • 윤년 (leap year) :  과년이라고도 하며, 역법인 태음력이나 태양력에서, 자연의 흐름에 대해서 생길 수 있는 오차를 보정하기 위해 삽입하는 날이나 주, 달이 들어가는 해를 말한다.
  • SAS automatically makes adjustments for leap years.

 

 

 

 

Q. An input data file has data expressiong in the form 10222001. Which SAS informat should you use to read these dates?   ( MMDDYY8. )

 

  • The SAS informat MMDDYYw. reads dates such as 10222001, 10/22/01 or 10-22-01.
  • In this case, the field width is 8.

 

[ 틀린 보기 ]

  • DATE6.
  • DATE8.
  • MMDDYY6.

 

 

Q. What is the minimum width of the TIMEw. informat?       ★ (5)   

  •  The minimum acceptable field width for the TIMEw. informat is 5.
  • If you specify a w value less than 5, you receive an error message in the SAS log.
  • TIMEw. informat 에서 w 의 최솟값은 5 !!!  만약 5보다 작은 수를 입력하면 에러 메세지 발생.

 

 

 

 

Q. Shown below are date and time expression and corresponding SAS datetime informats. Which date and time expression cannot be read by the informat that is shown beside it?

  • 30May2018:10:03:17.2 DATETIME20.     ( O )
  • 30May18 10:03:17.2 DATETIME18.      ( O )
  • 30May2018/10:03 DATETIME15.     ( O )
  • 30May2018/1003 DATETIME14.   ( X )      ------------------→ 시간, 분, 초가 delimiters 로 구분되어야 한다.

 

- In the time value of a date and time expression, you must use delimiters to separate the values for  hour,minutes,seconds 

 

 

 

 

 

 

 

Q. Suppose your program creates two variables foram an input file. Both variables are stored as SAS date values : FirstDay records the start of a billing cycle, and LastDay records the end of that cycle. What would you be the code for calculating the total number of days in the cycle?

  • TotDays = lastday - firstday + 1 ;         ------------------→  ★ 1 더하는거 주의하기 !!! 

 

- To find the number of days spanned by two dates, subtract the first day from the last day and add one.

- Because SAS date values are numeric values, they can easily be used in calculation.

- SAS date values 는 numeric 값이다 !! 

 

 

[ 틀린 보기 ]

  • TotDays = lastday - firstday ;  ( X )
  • TotDays = lastday / firstday ; ( X )
  • you cannot use date values in calculations.  ( X )