
[英]How to import multiple excel file into one excel file by using matlab?
[英]How to import one excel tab file in SAS involving multiple sections of information/data?
给您的两个想法。 首先,如果它是一个很小的文件,并且您知道所有节头的名称,则可以执行以下操作:
data example;
input id $ var1 - var5;
datalines;
NameA . . . . .
A1 11 11 21 24 14
A2 9 8 1 2 3
A3 4 4 3 4 3
A4 2 9 1 2 4
Total 26 32 26 32 24
"" . . . . .
NameB . . . . .
B1 3166 4135 1186 3775 5641
run;
data step1;
set example;
retain tablenum 0;
if id in ("NameA", "NameB", "NameC") then tablenum + 1;
run;
data table1 table2 /*table... all the way to table N*/;
set step1;
select (tablenum);
when (1) do; output table1; end;
when (2) do; output table2; end;
*when (N) do; *output tableN; *end;
end;
run;
如果您知道所有中断在哪里,则可以做的另一件事是使用proc import分段解决它,并使用range告诉SAS每个表的开始和停止位置(此示例假设您的excel电子表格进入Z列,而第二个表转到第140行):
PROC IMPORT OUT= WORK.tableA DATAFILE= "C:\xlsfile.xlsx"
DBMS=EXCEL REPLACE; Range = "SheetName$A1:Z57";
RUN;
PROC IMPORT OUT= WORK.tableB DATAFILE= "C:\xlsfile.xlsx"
DBMS=EXCEL REPLACE; Range = "SheetName$A61:Z140";
RUN;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.