OPTIONS NOCENTER PS=MAX LS=MAX;
LIBNAME S '.';
DATA A;
INPUT X $ @@;
CARDS;
A1 A2 A3 B1 B2 B3
;
RUN;
PROC PRINT ;
TITLE 'A';
RUN;
DATA S.TA;
SET A;
RUN;
PROC CONTENTS DATA=S.TA;
RUN;
DATA B;
SET A;
FILE 'NAME.MAP';
IF _N_=1 THEN
DO;
PUT '<?xml version="1.0" encoding="utf-8" ?>';
PUT '<SXLEMAP version="2.1">';
PUT '<TABLE name="zhr"> ';
PUT '<TABLE-PATH syntax="XPath">/Application </TABLE-PATH>';
END;
PUT '<COLUMN name="' X +(-1) '">';
PUT '<PATH>/Application/Credit@' X +(-1) '</PATH>';
PUT '<TYPE>numeric</TYPE>';
PUT '<DATATYPE>integer</DATATYPE>';
PUT '<LENGTH>8</LENGTH>';
PUT '</COLUMN>';
IF _N_=6 THEN
DO;
PUT '</TABLE>';
PUT '</SXLEMAP>';
END;
RUN;
注:X +(-1) 是为消除右边莫名其妙多出来的空格情况。