home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!NIHCU.BITNET!HIS
- Message-ID: <SAS-L%92073109143486@UGA.CC.UGA.EDU>
- Newsgroups: bit.listserv.sas-l
- Date: Fri, 31 Jul 1992 08:55:15 EDT
- Reply-To: Howard Schreier <HIS@NIHCU.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Howard Schreier <HIS@NIHCU.BITNET>
- Subject: Comma delimited output file
- Lines: 54
-
- CONTENT: Comment
- SUMMARY: Delimiters and quotes within char. values make it messy
-
- > In my opinion what is needed is a DELIMITER= option for the FILE
- > statement, analagous to the same option for the INFILE statement. This
- > option would put the chosen delimiter between each variable named in a
- > PUT statement, with no extra spaces, and using the usual default
- > formats. Or user specified formats. Then people who wanted tab or
- > comma delimiters could do something as simple as:
- >
- > data _null_;
- > set whatever;
- > file 'outfile.dat' delimiter=',';
- > put x y z;
- > run;
- >
- > And get exactly what they want. No fuss, no muss, no macros, no
- > SAS/ACCESS, no SAS/TOOLKIT and having to buy extra software.
- >
- > What could be simpler?
- >
- > Don MacQueen macq@miguel.llnl.gov
- > Lawrence Livermore Nat. Lab.
- > 7000 East Ave., L-307 (510) 423-1062
- > Livermore, CA 94550
-
- I agree that this would be a useful feature. However, it
- isn't quite 100% adequate, because of a little problem with
- character values. The problem: a character variable may
- contain the delimiter character as part or all of its
- content. The usual solution is to package the character
- fields in quotation marks, which in turn creates difficulty
- if quotation marks appear in content. The convention to
- handle this is doubling of such embedded quotation marks.
- So, if we had these three variable in an observation:
-
- var1 (numeric): 126
- var2 (character): O'Hara, Adam
- var3 (numeric): 621
-
- the comma-delimited record should be something like:
-
- 126,'O''Hara, Adam',621
-
- which consists of just three fields under these conventions.
- This would require something a bit more elaborate than the
- DELIMITER= option.
-
- /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
- \ Howard Schreier, U.S. Dept. of Commerce, Washington /
- / MVS 5.18 & 6.07 \
- \ Voice: (202) 377-4180 BITNET: HIS@NIHCU /
- / Fax: (202) 377-4614 INTERNET: HIS@CU.NIH.GOV \
- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-