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 (December 2001, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 20 Dec 2001 13:09:39 +0100
Reply-To:     Peter Crawford <peter.crawford@DB.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Crawford <peter.crawford@DB.COM>
Subject:      Re: Reading File
Content-type: text/plain; charset=iso-8859-1

Kathy Samson <Kathy.Samson@eds.com> wrote in > Ok, so I'm jumping on this bandwagon because I'm looking at the same thing, how to > easily handle a mixed bag of delimited files. Lets say, MVS with version 6.08 or > version 8, input & output. Something similar to specifying the delimited option on the > infile statement. Anything similar on the output side?

On v6 you have to organise your own delimiters, buton v8 there is an option for the file statement DSD which is similar to the same option on the infile statement. The default delimiter (again) is a comma, but can be overridden to semicolon like file '.personal.csv.txt' dsd dlm=';' lrecl=2000; The advantage offered by DSD processing surfaces when your data might contain a delimiter. If that happens, the normal, simple handling causes data to appear in the wrong columns. DSD processing masks a value containing a delimiter with double- quote (") marks. It is an old standard tolerated by _all_ software systems, including microsoft, oracle, ibm/lotus.

put ( _all_ ) (:) ; delivers the values in the data step data vector in varnum order and presented in their default formats. However, it is probably unsuitable for binary formats (formats like IB2. RB8. IEEE4. S370FPD8.) which might contain data mis-interpreted as control characters like end-of-file, line-feed, vertical-tab, carriage-return etc. on some platforms. For a generalised solution, it may be enough to format all numbers with best18. notation, and then all dates with yymmdd10. ... like format _numeric_ best18. &dates yymmdd10. ; I recommend yymmdd10. because it is recognised by semi-intelligent date recognisers (like excel import) clarifies century carries no language variations like MAY and MAI (see format eurdfdte. ) is visibly simple to recognise (we are talking data, not web/people ) but you may have another preference..... (delivering to a non-UK european world of number standards, format best. may confuse when the decimal fraction separator is expected to be a comma and the decimal-point/period/dot is considered a separator for thousands ! On those occasions when the recipient requires this european number support, best18. is replaced by numx22.8

The DSD option does not place delimiters between quoted strings in a put statement, like put "id" 'ac_no' 'name' ; Clearly this "feature" needs to be overcome to support a heading line in the .csv file that needs to reflect normal standards. Fortunately put "id," 'ac_no,' 'name' ; and put "id" "," 'ac_no' "," 'name' ; achieve what is necessary. When a generated solution is needed from dictionary.columns, this clip from our sql works select quote( trim( name )) into :headings separated by '&dlm' That &dlm has to be a constant, not only in the sql syntax, but also when it surfaces in a statement like put &headings; So, a suitable value for a tab character between our os/390 and ibm-aix %let dlm = "05"x The resolution of this macro variable has to be deferred until &headings is resolved in the put statement - and not in sql, so single quotes surround it in the "separated by '&dlm' clause.

that should provide enough of a start point to generate your own export macro ...........................

Regards Peter Crawford

Datum: 19/12/2001 23:40 An: SAS-L@LISTSERV.UGA.EDU

Antwort an: "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>

Betreff: Re: Reading File Nachrichtentext:

Kathy:

This solution was posted a couple of days ago for a similar problem, sorry, can't remember who posted it. The resultant output will be semi-colon delimited.

data a; do i = 1 to 5; do j = 1 to 4; do k = 1 to 3; do l = 1 to 2; output; end; end; end; end; run;

data _null_; set a; put _n_ (_all_) (";"); run;

-----Original Message----- From: Paul Choate [mailto:pchoate@JPS.NET] Sent: December 19, 2001 6:02 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Reading File

Hi Kathy,

If you use " put _all_; " the whole data vector is written with the variable name and an "=" preceding each. That's almost delimited.

Of course the Export facility isn't supported on MVS...too bad.

Kathy Samson <Kathy.Samson@eds.com> wrote in message news:<3C209B29.6A5A69AC@eds.com>... > Ok, so I'm jumping on this bandwagon because I'm looking at the same thing, how to > easily handle a mixed bag of delimited files. Lets say, MVS with version 6.08 or > version 8, input & output. Something similar to specifying the delimited option on the > infile statement. Anything similar on the output side? > Kathy > > "Karsten M. Self" wrote: > > > on Wed, Dec 19, 2001 at 01:59:39AM +0000, RogersEmail (rlemay1104@ROGERS.COM) wrote: > > > I have a delimited file which is constantly written to by another > > > program by a multitude of users. I would like to read it with SAS to > > > do reports, but when SAS is reading it in, if a user is trying to > > > write to the file with a BLAISE application (used for Computer > > > Assisted Terminal Interview), it says it is in use and give me an > > > error. > > > > > > My question is, Is there a way to read a file in SAS without taking it > > > exclusively? > > > > Probably. > > > > Highly dependent on some information you've neglected to provide, such > > as the operating system you're using. > > > > -- > > Karsten M. Self <kmself@ix.netcom.com> http://kmself.home.netcom.com/ > > What part of "Gestalt" don't you understand? Home of the brave > > http://gestalt-system.sourceforge.net/ Land of the free > > We freed Dmitry! Boycott Adobe! Repeal the DMCA! http://www.freesklyarov.org > > Geek for Hire http://kmself.home.netcom.com/resume.html > > > > ------------------------------------------------------------------------ > > Part 1.2Type: application/pgp-signature

--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


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