sas日期格式
DATETIMEw. Informat
Reads datetime values in the form ddmmmyy hh:mm:ss.ss or ddmmmyyyy hh:mm:ss.ss.
Syntax
DATETIMEw.
Syntax Description
w
specifies the width of the input field.
Default 18
Range 13–40
Details
The datetime values must be in the following form: ddmmmyy or ddmmmyyyy, followed by a blank or special character, followed by hh:mm:ss.ss (the time):
dd
is an integer between 01 and 31 that represents the day of the month.
mmm
is the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
hh
is an integer between 00 and 23 that represents hours.
mm
is an integer between 00 and 59 that represents minutes.
ss.ss
is the number of seconds ranging from 00–59 with the fraction of a second following the decimal point.
DATETIMEw. requires values for both the date and the time. However, the ss.ss portion is optional.
Note: SAS interprets a two-digit year as belonging to the 100-year span that is defined by the YEARCUTOFF= system option.
Note: SAS can read time values with AM and PM in them.
Comparisons
The DATETIMEw.d informat reads datetime values with optional separators in the form dd-mmm-yy<yy> hh:mm:ss.ss AM|PM, and the date and time can be separated by a special character.
The MDYAMPMw.d in format reads datetime values with optional separators in the form mm-dd-yy<yy> hh:mm:ss.ss AM | PM, and requires a space between the date and the time.
The YMDDTTMw.d informat reads datetime values with required separators in the form <yy>yy-mm-dd/hh:mm:ss.ss.
Example
input date_and_time datetime20.;
Data Line
Result
----+----1----+----2
16mar12:11:23:07.4
1647516187.4
16mar2012/11:23:07.4
1647516187.4
16mar2012/11:23 PM
1647559380.0
DATETIMEw. Informat
Reads datetime values in the form ddmmmyy hh:mm:ss.ss or ddmmmyyyy hh:mm:ss.ss.
Syntax
DATETIMEw.
Syntax Description
w
specifies the width of the input field.
Default 18
Range 13–40
Details
The datetime values must be in the following form: ddmmmyy or ddmmmyyyy, followed by a blank or special character, followed by hh:mm:ss.ss (the time):
dd
is an integer between 01 and 31 that represents the day of the month.
mmm
is the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
hh
is an integer between 00 and 23 that represents hours.
mm
is an integer between 00 and 59 that represents minutes.
ss.ss
is the number of seconds ranging from 00–59 with the fraction of a second following the decimal point.
DATETIMEw. requires values for both the date and the time. However, the ss.ss portion is optional.
Note: SAS interprets a two-digit year as belonging to the 100-year span that is defined by the YEARCUTOFF= system option.
Note: SAS can read time values with AM and PM in them.
Comparisons
The DATETIMEw.d informat reads datetime values with optional separators in the form dd-mmm-yy<yy> hh:mm:ss.ss AM|PM, and the date and time can be separated by a special character.
The MDYAMPMw.d in format reads datetime values with optional separators in the form mm-dd-yy<yy> hh:mm:ss.ss AM | PM, and requires a space between the date and the time.
The YMDDTTMw.d informat reads datetime values with required separators in the form <yy>yy-mm-dd/hh:mm:ss.ss.
Example
本博客所有内容是原创,如果转载请注明来源
http://blog.csdn.net/myhaspl/
input date_and_time datetime20.;
Data Line
Result
----+----1----+----2
16mar12:11:23:07.4
1647516187.4
16mar2012/11:23:07.4
1647516187.4
16mar2012/11:23 PM
1647559380.0
DATETIMEw. Informat
Reads datetime values in the form ddmmmyy hh:mm:ss.ss or ddmmmyyyy hh:mm:ss.ss.
Syntax
DATETIMEw.
Syntax Description
w
specifies the width of the input field.
Default 18
Range 13–40
Details
The datetime values must be in the following form: ddmmmyy or ddmmmyyyy, followed by a blank or special character, followed by hh:mm:ss.ss (the time):
dd
is an integer between 01 and 31 that represents the day of the month.
mmm
is the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
hh
is an integer between 00 and 23 that represents hours.
mm
is an integer between 00 and 59 that represents minutes.
ss.ss
is the number of seconds ranging from 00–59 with the fraction of a second following the decimal point.
DATETIMEw. requires values for both the date and the time. However, the ss.ss portion is optional.
Note: SAS interprets a two-digit year as belonging to the 100-year span that is defined by the YEARCUTOFF= system option.
Note: SAS can read time values with AM and PM in them.
Comparisons
The DATETIMEw.d informat reads datetime values with optional separators in the form dd-mmm-yy<yy> hh:mm:ss.ss AM|PM, and the date and time can be separated by a special character.
The MDYAMPMw.d in format reads datetime values with optional separators in the form mm-dd-yy<yy> hh:mm:ss.ss AM | PM, and requires a space between the date and the time.
The YMDDTTMw.d informat reads datetime values with required separators in the form <yy>yy-mm-dd/hh:mm:ss.ss.
Example
input date_and_time datetime20.;
Data Line
Result
----+----1----+----2
16mar12:11:23:07.4
1647516187.4
16mar2012/11:23:07.4
1647516187.4
16mar2012/11:23 PM
1647559380.0
DATEw. Format
Writes date values in the form ddmmmyy, ddmmmyyyy, or dd-mmm-yyyy.
Category:
Date and Time
Alignment:
Right
Syntax
Syntax Description
Details
Example
See Also
Syntax
DATEw.
Syntax Description
w
specifies the width of the output field.
Default
7
Range
5–11
Tip
Use a width of 9 to print a four-digit year without a separator between the day, month, and year. Use a width of 11 to print a four-digit year using a hyphen as a separator between the day, month, and year
Details
The DATEw. format writes SAS date values in the form ddmmmyy, ddmmmyyyy, or dd-mmm-yyyy, where
dd
is an integer that represents the day of the month.
mmm
is the first three letters of the month name.
yy or yyyy
is a two-digit or four-digit integer that represents the year.
Example
The example table uses the input value of 19068, which is the SAS date value that corresponds to March 16, 2012.
SAS Statement
Result
----+----1----+
put day date5.;
16MAR
put day date6.;
16MAR
put day date7.;
16MAR12
put day date8.;
16MAR12
put day date9.;
16MAR2012
put day date11.;
16-MAR-2012
本博客所有内容是原创,如果转载请注明来源
http://blog.csdn.net/myhaspl/
JULDAY.
1
| ||||
JULIAN.
1
| ||||
PDJULG.
1
| ||||
PDJULI.
1
| ||||
1In SAS, a Julian date is a date in the form YYNNN or YYYYNNN, where YY is a two-digit year, YYYY is a four-digit year, and NNN is the ordinal offset from January 1 of the year YY or YYYY. SAS processes Julian dates only for valid SAS dates. |
JULIAN.
1
| ||||
JULIAN7.
1
| ||||
JULDATE
1
| ||||
JULDATE7
1
| ||||
1In SAS, a Julian date is a date in the form YYNNN or YYYYNNN, where YY is a two-digit year, YYYY is a four-digit year, and NNN is the ordinal offset from January 1 of the year YY or YYYY. SAS processes Julian dates only for valid SAS dates. |