SAS中文论坛

标题: 请教:如何读取大于14位的数字 [打印本页]

作者: gogotiger    时间: 2016-1-15 07:42
标题: 请教:如何读取大于14位的数字
column ‘x1’ 在一个xlsx file里,x1是个14位 或 大于14-15位数字numeric column.
e.g.
x1
12345678901234
23456789012345
700289734351010
309829576219017
30298650673528
. . .

我用proc import读时结果成:
1.2345679E13
2.34567890E13
7.00289734E14
...

我试图把x1在xlsx里转换成char/text column,但结果还是一样。

请教如何解决这个问题?

谢谢!!!



作者: ahuige    时间: 2016-1-18 09:28
/*excel d:\temp\ahuige.xlsx*/
/*******************/
/*123456789012345*/
/*987654321098765*/
/*9123456789012345*/
/***********************/
/*
if it is within 15 digits (smaller than 9,007,199,254,740,992) then the numerical var is precise.
bigger than that you just forget about it, since SAS sets a bar there.
*/

proc import datafile="d:\temp\ahuige.xlsx" out=MYEXCEL ;
getnames=no;
run;
data ahuige;
format num best25.;
set MYEXCEL;
num=input(F1,best25.);
put _all_;
run;
作者: mich_ard    时间: 2016-1-26 03:20
是不是因为数值变量的default长度是12?加入一个这样的语句应该可以解决:
format x1 best20.

20可以根据你的数据的长度调节,16,18都可以。
作者: feige    时间: 2016-4-19 09:41
12长度只是超过长度的数值采用了科学计数法显示的长度。




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2