楼主: kutuomonk
3835 13

有关informat与input语句的问题。 [推广有奖]

11
soporaeternus 发表于 2010-4-9 23:22:36
没有小数点的话
我记得是从右开始取d位作为小数,不足以0补足
我再去确认下,快忘光了
Let them be hard, but never unjust

12
MyLoveSas 发表于 2010-4-9 23:51:27
是的,sas帮助文档里面就是这样说的optionally specifies the power of 10 by which to divide the value. If the data contain decimal points, the d value is ignored.

13
sdu0632 发表于 2010-4-10 13:20:35
I think this can address your question.

READING NUMERIC DATA Numeric INFORMATS are of the simple form of W.D where W is the width of the field to be read and D is the number of places to the right of the decimal. When reading numeric input, SAS will do as we ask, unless the data tell it otherwise. This is explained in the following table:

Input Data    INFORMAT     SAS Data Value
12345              6.0                   12345
12.345             6.0                   12.345
12345              6.2                   123.45
12.345             6.2                   12.345

The first and third examples show how SAS does as we asked – it read in the six-byte number and assigned the appropriate number of decimals (0 and 2). The second and fourth examples show that SAS did what the data told it – it read in the six-byte number but since the data already had decimal places, SAS listened to the data and maintained the decimal places. SAS can also read in numeric data that are formatted with commas and dollar signs as is seen in the next table.
已有 1 人评分经验 热心指数 收起 理由
crackman + 100 + 2 精彩帖子

总评分: 经验 + 100  热心指数 + 2   查看全部评分

14
horace_chen 发表于 2010-4-10 15:44:19
学习了~~~~

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-26 08:38