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 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 11 Nov 2003 16:07:45 +0100
Reply-To:     "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM>
Subject:      Re: how to merger external files not using X command in SAS
Comments: To: Leon <leonlyzhou@21CN.COM>
Content-Type: text/plain; charset="iso-8859-1"

Hi Leon,

What's easier than a DOS command like: COPY File1+File2+File3+File4 FileAll

This concatenates all 4 files, upto their possible EOF indicator ('1A'x) into FileAll. I guess this is what you want.

Regards - Jim. -- . . . . . . . . . . . . . . . .

Jim Groeneveld, MSc. Biostatistician Science Team Vitatron B.V. Meander 1051 6825 MJ Arnhem Tel: +31/0 26 376 7365 Fax: +31/0 26 376 7305 Jim.Groeneveld@Vitatron.com www.vitatron.com

My computer has the solutions, I have the problems.

[common disclaimer]

-----Original Message----- From: Leon [mailto:leonlyzhou@21CN.COM] Sent: Tuesday, November 11, 2003 15:03 To: SAS-L@LISTSERV.UGA.EDU Subject: Re: how to merger external files not using X command in SAS

Jim,Thank you! I am using SAS/AF to develop a frame application. I want to copy 4 files with EBCDIC format into one file as a part of function. As you know,X command always prompt a DOS command window. It is not comfortable. So I am thinking using Windows API to do it.

I found there are a API function of CopyFile in KERNERL32.DLL. Here is the steps I did:

1) create an attribute table for WinAPI

Routine CopyFileA module=KERNEL32 minarg=3 maxarg=3 stackpop=called returns=ushort;

arg 1 input char format=$cstr200.; * FROM filename *; arg 2 input char format=$cstr200.; * TO filename *; arg 3 input num byvalue format=pib4. ; * 1=Do Not Overwrite Existing *; * 0=Overwrite Existing File *;

I save it as 'd:\temp\winapi.txt';

2) then write code as below:

filename SASCBTBL 'd:\temp\win32api.txt'; data _null_; rc=modulen('*e','CopyFileA', 'd:\temp\a1', 'd:\temp\ebcdic', 0); /* Replace if exists */ run;

I submit the code as batch mode. It worked.

But it is only copy one file to another file.

My purpose is copy 4 files like a1,a2,a3,a4 into file, say, a5

So I changed the code above to:

filename SASCBTBL 'd:\temp\win32api.txt'; data _null_; rc=modulen('*e','CopyFileA', 'd:\temp\a1+d:\temp\a2+d:\temp\a3+d:\temp\a4', 'd:\temp\a5', 0); /* Replace if exists */ run;

But it failed.

Does anybody have good idea to make it happen? Really appreciate!!!

jim.groeneveld@VITATRON.COM (Groeneveld, Jim) wrote in message news:<81BFA8F7807F1349AD6C16AD00A1AB9BD3A61E@AMSM1BMSGM01.ent.core.medtronic.com>... > Hi Leon, > > Handling, merging, combining external (ascii) files, apparently not SAS datasets, is something you should do with the appropriate tool, i.e. not SAS, but DOS. DOS is started from SAS by the X command, the CALL SYSTEM command, or the %SYSEXEC macro call. But even better DOS is started from Windows directly by opening a DOS window and issuing the needed commands or starting a batch file doing it. This is the quickest way. Any other way, e.g. using SAS to read the ascii files and write them all to one output ascii file, is a roundabout way. > > Regards - Jim. > -- > . . . . . . . . . . . . . . . . > > Jim Groeneveld, MSc. > Biostatistician > Science Team > Vitatron B.V. > Meander 1051 > 6825 MJ Arnhem > Tel: +31/0 26 376 7365 > Fax: +31/0 26 376 7305 > Jim.Groeneveld@Vitatron.com > www.vitatron.com > > My computer has the solutions, I have the problems. > > [common disclaimer] > > > -----Original Message----- > From: Leon [mailto:leonlyzhou@21CN.COM] > Sent: Tuesday, November 11, 2003 10:09 > To: SAS-L@LISTSERV.UGA.EDU > Subject: how to merger external files not using X command in SAS > > > HI, > Does anybody have idea to merger some external files in SAS? > > I know it is easy to use X command to copy files into one. > > What about not using X command? Any different method? > > > Thank you!


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