标题: 新手!sas programming by example 里面习题的问题? [打印本页] 作者: shiyiming 时间: 2005-10-25 21:28 标题: 新手!sas programming by example 里面习题的问题? Write a sas progeam to read data from noth files and create a sas data set:
File one
cody 100
pass 98
File two
Frank 90
Beans 98
我是这么写的:
data file1;
input name $ 1-10 score 11-13;
datalines;
cody 100
pass 98
;
data file2;
input name $ 1-10 score 11-13;
datalines;
frenks 90
beans 98
;
Now I have two seperate file, then:
data twofiles;
if not lastrec1 then infile 'file1' end=lastrec1;
else infile 'file2';
input name $1-10 score 11-13;
proc print;
run;
结果成了:
ERROR: Physical file does not exist, E:\WINNT\system32\file1.
ERROR: Physical file does not exist, E:\WINNT\system32\file2.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TWOFILES may be incomplete. When this step was stopped there were 0
observations and 2 variables.
WARNING: Data set WORK.TWOFILES was not replaced because this step was stopped.
可是我看答案&我写的没什么区别,问什么找不到文件呢,不都存在临时文件夹work里面的吗?
谢谢各位了! <!-- s:P --><img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" /><!-- s:P --> <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->作者: shiyiming 时间: 2005-10-26 11:38 标题: to liudreams 应该再加上两句吧
[code:c501f]filename file1 'E:\WINNT\system32\file1'; /*指定file1的物理位置*/
filename file2 'E:\WINNT\system32\file2'; /*指定file2的物理位置*/[/code:c501f]作者: shiyiming 时间: 2005-10-26 14:43 标题: 谢谢,可是结果成这样了! filename file1 'd:\sas\exercise\example\file1.sas7bdat';
filename file2 'd:\sas\exercise\example\file2.sas7bdat';
data twofiles;
if not lastrec1 then infile file1 end=lastrec1;
else infile file2;
input name $1-10 score 11-13;
proc print;
run;
可是结果成这样了:
NOTE: 12 records were read from the infile FILE1.
The minimum record length was 6.
The maximum record length was 256.
One or more lines were truncated.
NOTE: 4 records were read from the infile FILE2.
The minimum record length was 6.
The maximum record length was 256.
One or more lines were truncated.
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.TWOFILES has 14 observations and 2 variables.
NOTE: DATA statement used:
real time 0.20 seconds
cpu time 0.12 seconds