LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: sas-l@uga.edu
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;


Back to: Top of message | Previous page | Main SAS-L page