Prev: Variable reduction method
Next: SUBSTR Madness
From: Yu Zhang on 30 Sep 2009 12:55 Dear _null_, After i modified a bit on your program,I am running into a problem which I can not explain why. I change the statetment filename in ('.\epi514\data\*.txt', '.\epi514\data\*.html', "%sysfunc(pathname(FT15F001,F))") lrecl=32767; to filename in ('"%sysfunc(pathname(FT15F001,F))") lrecl=32767; and comment out the file deletion statements in the subsequent data step. I got following error message: ERROR: File is in use, C:\DOCUME~1\xxxxx\LOCALS~1\Temp\SAS Temporary Files\_TD1472\#LN00089. However, there is no error in your program. I think when filevar was assgined to the fileref FT15F001, the file was opened for read and write at same time, which is equivalent to what the modified program does. Can you please explain why it is ok in your program/ --------------the modified program----------- filename FT15F001 temp; parmcards; necessary evil ;;;; run; filename in ( "%sysfunc(pathname(FT15F001,F))") lrecl=32767; data _null_; length filename lfilename filevar $256; retain filevar; lfilename = filename; infile in eov=eov filename=filename; input; if _n_ eq 1 or eov then do; put _infile_/eov=/filename=; eov = 0; filevar = tranwrd(filename,'\data\','\data2\'); put filevar=; end; file dummy filevar=filevar lrecl=32767; put _infile_; run; Thank you ! Yu On Tue, Sep 29, 2009 at 7:15 AM, Data _null_; <iebupdte(a)gmail.com> wrote: > You want to be careful using SAS for this. I would not MOVE binary > files and you have to be sure you don't truncate the reacords or > otherwise change the files. Here is a copy a delete as you go > program. It uses a litte trick because SAS wont close a file until it > opens another. I used Mike Zdeb's filename paths. > > filename FT15F001 temp; > parmcards; > necessary evil > ;;;; > run; > > filename in ('.\epi514\data\*.txt', '.\epi514\data\*.html', > "%sysfunc(pathname(FT15F001,F))") lrecl=32767; > > data _null_; > length filename lfilename filevar $256; > retain filevar; > lfilename = filename; > infile in eov=eov filename=filename; > input; > if _n_ eq 1 or eov then do; > eov = 0; > filevar = tranwrd(filename,'\data\','\data2\'); > if _n_ ne 1 then do; > rc = filename('FT58F001',lfilename); > rc = fdelete('FT58F001'); > if rc ne 0 then error; > rc = filename('FT58F001'); > end; > end; > > file dummy filevar=filevar lrecl=32767; > put _infile_; > run; > > > > On 9/27/09, ash007 <ramsamyashley(a)gmail.com> wrote: > > Hello Sas-Users, > > > > How can I move all the file .Txt and the file .Html in a directory > > (without using the X command)? I am working on Window environment. > > > > Thanks. > > > > Ash007. > > >
From: Paige Miller on 30 Sep 2009 13:54 On Sep 30, 9:07 am, ash007 <ramsamyash...(a)gmail.com> wrote: > Hi everyone, > > Thanks for your reply. > > How can I copy a sas Dataset (binary file) without using 'proc copy' ? > > Thanks. > > ash007. Data steps can copy SAS data sets, but why would you not want to use PROC COPY, as it is the most efficient way to do this? -- Paige Miller paige\dot\miller \at\ kodak\dot\com
From: "Data _null_;" on 30 Sep 2009 13:19 The program gives you the error because the INFILE statement has opened the TEMP file defined by "SYSFUNC... then when _N_ eq 1 the program tries to create a new filename with this statement filevar = tranwrd(filename,'\data\','\data2\'); but \data\ is not part of the path of the temp file so the name assigned to FILEVAR is not changed. Then the program tries to open the file defined in FILEVAR. file dummy filevar=filevar lrecl=32767; this is what causes the FILE IN USE message. The way I used this file in the original version of this would not cause a problem. However you question makes me wonder. Where does the record read from this TEMP file go. I need to figure that out and report back. On 9/30/09, Yu Zhang <zhangyu05(a)gmail.com> wrote: > Dear _null_, > > After i modified a bit on your program,I am running into a problem which I > can not explain why. > I change the statetment > filename in ('.\epi514\data\*.txt', '.\epi514\data\*.html', > "%sysfunc(pathname(FT15F001,F))") lrecl=32767; > > to > filename in ('"%sysfunc(pathname(FT15F001,F))") > lrecl=32767; > > and comment out the file deletion statements in the subsequent data step. I > got following error message: > > > ERROR: File is in use, C:\DOCUME~1\xxxxx\LOCALS~1\Temp\SAS > Temporary Files\_TD1472\#LN00089. > > However, there is no error in your program. I think when filevar was > assgined to the fileref FT15F001, the file was opened for read and write at > same time, which is equivalent to what the modified program does. > > Can you please explain why it is ok in your program/ > > --------------the modified program----------- > > filename FT15F001 temp; > parmcards; > necessary evil > ;;;; > run; > > filename in ( > "%sysfunc(pathname(FT15F001,F))") lrecl=32767; > > data _null_; > length filename lfilename filevar $256; > retain filevar; > lfilename = filename; > infile in eov=eov filename=filename; > input; > if _n_ eq 1 or eov then do; > put _infile_/eov=/filename=; > eov = 0; > > filevar = tranwrd(filename,'\data\','\data2\'); > put filevar=; > > end; > file dummy filevar=filevar lrecl=32767; > put _infile_; > run; > > Thank you ! > > Yu > > > > On Tue, Sep 29, 2009 at 7:15 AM, Data _null_; <iebupdte(a)gmail.com> wrote: > > You want to be careful using SAS for this. I would not MOVE binary > > files and you have to be sure you don't truncate the reacords or > > otherwise change the files. Here is a copy a delete as you go > > program. It uses a litte trick because SAS wont close a file until it > > opens another. I used Mike Zdeb's filename paths. > > > > filename FT15F001 temp; > > parmcards; > > necessary evil > > ;;;; > > run; > > > > filename in ('.\epi514\data\*.txt', '.\epi514\data\*.html', > > "%sysfunc(pathname(FT15F001,F))") lrecl=32767; > > > > data _null_; > > length filename lfilename filevar $256; > > retain filevar; > > lfilename = filename; > > infile in eov=eov filename=filename; > > input; > > if _n_ eq 1 or eov then do; > > eov = 0; > > filevar = tranwrd(filename,'\data\','\data2\'); > > if _n_ ne 1 then do; > > rc = filename('FT58F001',lfilename); > > rc = fdelete('FT58F001'); > > if rc ne 0 then error; > > rc = filename('FT58F001'); > > end; > > end; > > > > file dummy filevar=filevar lrecl=32767; > > put _infile_; > > run; > > > > > > > > > > On 9/27/09, ash007 <ramsamyashley(a)gmail.com> wrote: > > > > > > > > > Hello Sas-Users, > > > > > > How can I move all the file .Txt and the file .Html in a directory > > > (without using the X command)? I am working on Window environment. > > > > > > Thanks. > > > > > > Ash007. > > > > > > >
From: Arthur Tabachneck on 30 Sep 2009 19:32 Ash, You started this thread, last week, with the question: "How can I move all the file .Txt and the file .Html in a directory (without using the X command)? I am working on Window environment." Now you are asking: "How can I copy a sas Dataset (binary file) without using 'proc copy' ?" What are you looking for? Art ------- On Wed, 30 Sep 2009 06:07:44 -0700, ash007 <ramsamyashley(a)GMAIL.COM> wrote: >Hi everyone, > >Thanks for your reply. > >How can I copy a sas Dataset (binary file) without using 'proc copy' ? > >Thanks. > >ash007.
From: ash007 on 1 Oct 2009 03:39
Hello Arthur, Yes I have started with the question on Ascii Files but now I need to know for the binary file.because I have a 10 Giga dataset and with "proc copy" it lasts 2 hours.... and with "copy&past" it lasts only 5 minutes. Thanks. Ash007. On Oct 1, 1:32 am, art...(a)NETSCAPE.NET (Arthur Tabachneck) wrote: > Ash, > > You started this thread, last week, with the question: > > "How can I move all the file .Txt and the file .Html in a directory (without > using the X command)? I am working on Window environment." > > Now you are asking: "How can I copy a sas Dataset (binary file) without > using 'proc copy' ?" > > What are you looking for? > > Art > ------- > > On Wed, 30 Sep 2009 06:07:44 -0700, ash007 <ramsamyash...(a)GMAIL.COM> wrote: > >Hi everyone, > > >Thanks for your reply. > > >How can I copy a sas Dataset (binary file) without using 'proc copy' ? > > >Thanks. > > >ash007. |