t****n 发帖数: 1879 | 1 针对一般的excel使用proc import做data input还是蛮简单的。
但是如果有new data update,新的excel file中个别的variable常常改变了format,
比如numeric变成了character或者反之。再使用proc import出来的new sas dataset就
不能与旧的merge了。
而proc import 本身也有问题,就算是同一个excel,不同的电脑做proc import,有时
候,同一个variable居然会出来不同的format。
大家有什么妙法吗?
先谢了。 |
d*******o 发帖数: 493 | 2 Once you use Proc Import, you will eventually have data step infile code on
your log windows. Copy it and save it for future use. Once you like to
change any format, change the data step infile code, instead of your proc
import. |
t****n 发帖数: 1879 | 3 code:
proc import out = work.n3
datafile="c:\n3.xls"
dbms=excel replace;
range="sheet1$";
getnames=YES;
MIXED=NO;
scantext=YES;
usedata=yes;
scantime=yes;
run; |
d*******o 发帖数: 493 | 4 By default, in Proc import, SAS read the first 8 observations to decide the
variable type. You can add more rows for SAS to guess.
proc import out = work.n3
datafile="c:\n3.xls"
dbms=excel replace;
range="sheet1$";
getnames=YES;
MIXED=NO;
scantext=YES;
usedata=yes;
scantime=yes;
GUESSINGROWS=10000;
run;
If you try to control exact variable type or length, I suggest to transform
EXCEL to CSV. Then you will specify anything there. |
k*****u 发帖数: 1688 | 5 GUESSINGROWS 的功能是这个啊,我还以为是用来告诉sas大概有多少个观测值呢。哈哈
学生还是不实际啊 |