SAS中的Infile声明

时间:2014-02-21 15:41:10

标签: sas

infile语句中是否有跳过前n行的选项?我在import语句中知道但是在infile语句中有一个简单的方法吗?

data sub;
  length start end r $100 a$20 i n $1000;
  infile "blah.txt" lrecl = 50000 dsd delimiter = '09'x ;
  input start end r a i n
   ;
 run;

1 个答案:

答案 0 :(得分:2)

你可以使用firstobs选项:

%let n=2;
data sub;
  length start end r $100 a$20 i n $1000;
  infile "blah.txt" lrecl = 50000 dsd delimiter = '09'x firstobs=&n;
  input start end r a i n; 
 run;

或者,您可以使用条件逻辑(更灵活但效率更低):

%let n=2;
data sub;
  length start end r $100 a$20 i n $1000;
  infile "blah.txt" lrecl = 50000 dsd delimiter = '09'x ;
  if _n_ ge &n then input start end r a i n; 
 run;