设为首页 加入收藏

TOP

数学之路-sas备忘(16)(二)
2015-07-24 11:10:30 来源: 作者: 【 】 浏览:3
Tags:数学 -sas 备忘
0
put event datetime21.2;
10NOV2012:03:49:19.00
============================data _null_;
run;

?

?

30MAR2015:17:25:51.91

===============

?

DATETIMEw. Informat


?

?

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. mmmis the first three letters of the month name. yy or yyyyis a two-digit or four-digit integer that represents the year. hh is an integer between 00 and 23 that represents hours. mmis 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 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 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-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

?

\

Writes SAS date values in the form yymmdd or yy–mm–dd, where a hyphen is the separator and the year appears as either 2 or 4 digits.

?

YYMMDDw.

Arguments

w

specifies the width of the output field.

Default 8
Range 2–10
Interaction When w has a value of from 2 to 5, the date appears with as much of the year and the month as possible. When w is 7, the date appears as a two-digit year without hyphens.

Details

The YYMMDDw. format writes SAS date values in the form yymmdd or yy–mm–dd. Here is an explanation of the syntax: yyis a two-digit or four-digit integer that represents the year. –is the separator.mmis an integer that represents the month. ddis an integer that represents the day of the month.

Comparisons

The YYMMDDw.d format is similar to the YYMMDDxw.d format, except the YYMMDDxw.d format contains separators, such as a colon, slash, or period between the year, month, and day.

Example

The following examples use the input value of 18720, which is the SAS date value that corresponds to April 3, 2011.
Statements Results
 
----+----1----+
a=put(18720,yymmdd2.);
11
a=put(18720,yymmdd3.);
11
a=put(18720,yymmdd4.);
1104
a=put(18720,yymmdd5.);
11-04
a=put(18720,yymmdd6.);
110403
a=put(18720,yymmdd7.);
110403
a=put(18720,yymmdd8.);
11-04-03
a=put(18720,yymmdd10.);
2011-04-03
========================

?

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇sqoop导入时删除string类型字段的.. 下一篇【MongoDB】windows下搭建Mongo主..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·数据库:推荐几款 Re (2025-12-25 12:17:11)
·如何最简单、通俗地 (2025-12-25 12:17:09)
·什么是Redis?为什么 (2025-12-25 12:17:06)
·对于一个想入坑Linux (2025-12-25 11:49:07)
·Linux 怎么读? (2025-12-25 11:49:04)