Date: Thu, 8 Nov 2007 15:35:17 -0000
Reply-To: tanwan <tanwanzang@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: tanwan <tanwanzang@YAHOO.COM>
Organization: http://groups.google.com
Subject: Re: feeding macro from a file
In-Reply-To: <1194529812.236424.41480@v23g2000prn.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
Import into SAS that file that specifies the name of each csv file you
need to import into SAS. Let us call the resulting SAS file 'TOIMP'.
Assume TOIMP has 2 variables X, and Y, just as you used them in your
macro above, where X is source, and Y is destination. Then run the
following macro. Edit to suit. You may take a coffee break as it
works, (if the files are big and are in the hundreds)!
%macro IMPCSV;
options mprint;
proc sql noprint;
select count(*) into :limit from TOIMP;
%let limit=&limit;
select x into :x1 - :x&limit from TOIMP;
select y into :y1 - :y&limit from TOIMP;
quit;
%do loop = 1 %to &limit;
proc import datafile="E:\dados planb\Planb\Producao\&&x&loop...csv"
out=planb.y&loop
dbms=csv
replace;
getnames=yes;
%end;
run;
%mend IMPCSV;
%IMPCSV;
|