如何在sas中正确导入带分隔符的txt数据
1个回答
展开全部
data A ;
infile f1;
LENGTH ID TIME_STAMP $20;
LENGTH PAGE_NAME $50;
input;
A =tranwrd(tranwrd(_infile_, "ID~", "="), "TIME_STAMP~","=");
ID=SCAN(SCAN(A, 2, "="), 1, "|");
A =SCAN(A, 3, "=");
A =tranwrd(A, "PAGE_NAME~", "=");
TIME_STAMP = SCAN(SCAN(A, 1, "="), 1, "|");
A =SCAN(A, 2, "=");
A =tranwrd(A, "PORTLET_NAME~", "=");
PAGE_NAME = SCAN(SCAN(A, 1, "="), 1, "|");
A =SCAN(A, 2, "=");
run;
infile f1;
LENGTH ID TIME_STAMP $20;
LENGTH PAGE_NAME $50;
input;
A =tranwrd(tranwrd(_infile_, "ID~", "="), "TIME_STAMP~","=");
ID=SCAN(SCAN(A, 2, "="), 1, "|");
A =SCAN(A, 3, "=");
A =tranwrd(A, "PAGE_NAME~", "=");
TIME_STAMP = SCAN(SCAN(A, 1, "="), 1, "|");
A =SCAN(A, 2, "=");
A =tranwrd(A, "PORTLET_NAME~", "=");
PAGE_NAME = SCAN(SCAN(A, 1, "="), 1, "|");
A =SCAN(A, 2, "=");
run;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询