The following SAS program is submitted:
data WORK.DATE_INFO;
X=’04jul2005’d;
DayOfMonth=day(x);
MonthOfYear=month(x);
Year=year(x);
run;
What types of variables are DayOfMonth, MonthOfYear, and Year?
A. DayOfMonth, Year, and MonthOfYear are character.
B. DayOfMonth, Year, and MonthOfYear are numeric.
C. DayOfMonth and Year are numeric. MonthOfYear is character.
D. DayOfMonth, Year, and MonthOfYear are date values.
Answer: B
注解:d的作用是将“数字day + 英文month前三个字母 + 数字year”格式的日期,转化成SAS日期,即以1960年1月1日为0,2005年7月4日则为16621。DAY, MONTH, YEAR这三个function则是分别返回一个SAS格式日期的日,月,年,并且返回的值均为数值型。
One thought to “SAS Base (16)”