% @language="vbscript" %>
| 欢迎光临 | ![]() |
![]() |
![]() |
|
|
|
|
|
libname l'c:\'; proc import out= work.Q401 /******Need Change*********************/ datafile= "c:\yourdata.xls" /************Need change*********************/ dbms=excel2000 replace; getnames=yes; run; /* Running the renaming macro */ options macrogen mprint mlogic; %macro rename(lib,dsn); options pageno=1 nodate; proc contents data=&lib..&dsn; title "Before Renaming All Variables"; run; proc sql noprint; select nvar into :num_vars from dictionary.tables where libname="&LIB" and memname="&DSN"; select distinct(name) into :var1- :var%TRIM(%LEFT(&num_vars)) from dictionary.columns where libname="&LIB" and memname="&DSN"; quit; run; proc datasets library=&LIB; modify &DSN; rename %do i=1 %to &num_vars; &&var&i=&&var&i.._01Q4 /*******************Need Change here********************/ %end; ; quit; run; options pageno=1 nodate; proc contents data=&lib..&dsn; title "After Renaming All Variables"; run; %mend rename; %rename (WORK,Q401); /*************************** Need change here***************/ data l.renamed_data_01Q4; set Q401; run;
|
|
MOST
PROGRAMS WERE WRITTEN BY MYSELF, IF NOT, SOURCE WILL BE CITED.
All RIGHT RESERVED. FREE WEB HOST PROVIDED BY
BRINKSTER.COM
|