Date: Fri, 9 Jul 2010 16:54:04 -0400
Reply-To: Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tom Abernathy <tom.abernathy@GMAIL.COM>
Subject: Re: Can one import delimited file directly with proc sql?
Cool. Did you try using a field in the input table as the filename? So if I
had a table with a series of files to open I could output a new table with
the values from the files attached to the original row that had the
filename?
FILE VALUE
a.dat 100
b.dat 205
....
On Fri, 9 Jul 2010 11:40:28 -0400, Randy Herbison <RandyHerbison@WESTAT.COM>
wrote:
>Hi Art,
>
>I don't know if you would consider this directly:
>
>**** text.txt has one record, and the record has a single value of 45 in
columns 1-2 ****;
>
>proc sql;
>create table oldster
>as select
> ' ' as newage,
> filename('txtFile','c:\temp\test.txt') as sysrc1,
> fopen('txtFile') as fid,
> fread(calculated fid),
> fget(calculated fid, calculated newage),
> fclose(calculated fid) as sysrc2,
> filename('txtFile',' ') as sysrc3,
> *
> from sashelp.class
> where name='Alfred'
>;
>quit;
>
>-Randy
>
>
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Arthur
Tabachneck
>Sent: Friday, July 09, 2010 10:34 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Can one import delimited file directly with proc sql?
>
>Say one has a file that only contains a number. E.g., a text file that
>only has one entry, say the number 45.
>
>Is there a way to use proc sql to import that file?
>
>Art
|