由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - help. txt 读入问题
相关主题
请教一个SAS读中文数据库的问题请教一个SAS 数据读入的问题
a quick question importing txt into SASreading data into sas 问题
问个SAS 数据读入的问题请教个SAS问题
请教一个SAS数据input的问题怎样用R除掉DUPLICATED RECORD
问一个数据分析的问题问个SAS PROC CORR的问题
Sas code help- infileSAS DATA PROCESSING 问题
求教SAS问题[SAS]问个简单的data manipulation
请教个有关SAS 的问题晕菜了, logistic regression with time-dependent covariates
相关话题的讨论汇总
话题: id1话题: id2话题: best6话题: key1话题: input
进入Statistics版参与讨论
1 (共1页)
s******r
发帖数: 1524
1
读txt file, 一个18位的整数,无论是数字还是字符,最后两位总是读不对,前16位
都没问题。Any idea?
Thx
l*********s
发帖数: 5409
2
SAS? maybe you need to specify informats
s******r
发帖数: 1524
3
format best19. informat best19.
format $18. informat $18.
都试了,不work. 很怀疑SAS当float读入,最后几位给截掉了。

【在 l*********s 的大作中提到】
: SAS? maybe you need to specify informats
l***a
发帖数: 12410
4
应该是你code有问题
给个txt的片断加上你的code一块看看

【在 s******r 的大作中提到】
: format best19. informat best19.
: format $18. informat $18.
: 都试了,不work. 很怀疑SAS当float读入,最后几位给截掉了。

s******r
发帖数: 1524
5
data test;
LENGTH key1 8 key2 8 id1 8 id2 8;
FORMAT key1 BEST6. key2 BEST6. id1 $19. id2 $19.;
INFORMAT key1 BEST6. key2 BEST6. id1 $19. id2 $19.;
INPUT key1 : BEST6. key2 : BEST3. id1 : $19. id2 : $19.;
INFILE datalines DLM='7C'x MISSOVER DSD;
datalines;
18949|21|1942303098494173209 |1368841116323724091
;
run;

【在 l***a 的大作中提到】
: 应该是你code有问题
: 给个txt的片断加上你的code一块看看

h********o
发帖数: 103
6
In SAS, numeric variables are stored in 8-byte floating point form and the
numbers have a precision of about 16 significant digits. Therefore, you last
two digits are not the same as the original data because of rounding error.
h********o
发帖数: 103
7
You can use character instead:
Suppose your text file have a numeric value: 123456789012345678
====================
data test;
infile "h:\test.txt";
input score : $18.;
run;
proc print data = test;
run;
=====================
Obs score
1 123456789012345678
s******r
发帖数: 1524
8
I did use $19. in my sample code. Still not right with last digits.

【在 h********o 的大作中提到】
: You can use character instead:
: Suppose your text file have a numeric value: 123456789012345678
: ====================
: data test;
: infile "h:\test.txt";
: input score : $18.;
: run;
: proc print data = test;
: run;
: =====================

h********o
发帖数: 103
9
Why you use both LENGTH and INFORMAT statements? also you define your ID1,
ID2 variables as character in the INPUT statement, you should use:
length ID1 $8 ID2 $18;
not
length ID1 8 ID2 18;
s******r
发帖数: 1524
10
It works. Did not use input for a while, forgot lots of stuff.

【在 h********o 的大作中提到】
: Why you use both LENGTH and INFORMAT statements? also you define your ID1,
: ID2 variables as character in the INPUT statement, you should use:
: length ID1 $8 ID2 $18;
: not
: length ID1 8 ID2 18;

1 (共1页)
进入Statistics版参与讨论
相关主题
晕菜了, logistic regression with time-dependent covariates问一个数据分析的问题
请教一个SQL 的问题Sas code help- infile
SQL check likeness between two large tables求教SAS问题
[合集] 请问sas input的一个问题请教个有关SAS 的问题
请教一个SAS读中文数据库的问题请教一个SAS 数据读入的问题
a quick question importing txt into SASreading data into sas 问题
问个SAS 数据读入的问题请教个SAS问题
请教一个SAS数据input的问题怎样用R除掉DUPLICATED RECORD
相关话题的讨论汇总
话题: id1话题: id2话题: best6话题: key1话题: input