一眼瞬间 发表于 2013-10-12 06:15 
谢谢LS指点!
It works. 只是我实际download 下来的是很大的表格,格式如第一个excel表。不知道怎么转 ...
Suppose that you have imported the excel file into SAS dataset ABC, then the variable names that starting with numbers become labels of newly create variables. You could use these labels to create the names of new variables. Since the variables are all numeric except code, a numerical array was used to track the labels in the following code.
data _null_;
set abc (obs=1);
array num_name{*} _numeric_;
call symput('v1', scan(vlabel(num_name[1]), 2, '()')); /* &v1=p from 26492(P) */;
call symput('v2', scan(vlabel(num_name[2]), 2, '()')); /* &v2=WC02999 from 26492K(WC02999) */
call symput('v3', scan(vlabel(num_name[3]), 2, '()')); /* &v3=WC04551 from 26492K(WC04551) */
call symput('code1', scan(vlabel(num_name[1]), 1, '()')); /* &code1 = 26492K from 26492K(P) */
call symput('code2', scan(vlabel(num_name[4]), 1, '()')); /* &code2 = 29060T from 29060T(P) */
run;
data abc_1;
set abc (rename=(code=date_c));
array num{*} _numeric_;
code = "&code1";
&v1 = num[1];
&v2 = num[2];
&v3 = num[3];
output;
code = "&code2";
&v1 = num[4];
&v2 = num[5];
&v3 = num[6];
output;
keep date_c code &v1 &v2 &v3;
run;