home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / bit / listserv / sasl / 3511 < prev    next >
Encoding:
Text File  |  1992-07-31  |  2.5 KB  |  66 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!NIHCU.BITNET!HIS
  3. Message-ID: <SAS-L%92073109143486@UGA.CC.UGA.EDU>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Fri, 31 Jul 1992 08:55:15 EDT
  6. Reply-To:     Howard Schreier <HIS@NIHCU.BITNET>
  7. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. From:         Howard Schreier <HIS@NIHCU.BITNET>
  9. Subject:      Comma delimited output file
  10. Lines: 54
  11.  
  12. CONTENT:  Comment
  13. SUMMARY:  Delimiters and quotes within char. values make it messy
  14.  
  15. > In my opinion what is needed is a DELIMITER= option for the FILE
  16. > statement, analagous to the same option for the INFILE statement. This
  17. > option would put the chosen delimiter between each variable named in a
  18. > PUT statement, with no extra spaces, and using the usual default
  19. > formats. Or user specified formats. Then people who wanted tab or
  20. > comma delimiters could do something as simple as:
  21. >
  22. > data _null_;
  23. >   set whatever;
  24. >   file 'outfile.dat' delimiter=',';
  25. >   put x y z;
  26. >   run;
  27. >
  28. > And get exactly what they want. No fuss, no muss, no macros, no
  29. > SAS/ACCESS, no SAS/TOOLKIT and having to buy extra software.
  30. >
  31. > What could be simpler?
  32. >
  33. > Don MacQueen                   macq@miguel.llnl.gov
  34. > Lawrence Livermore Nat. Lab.
  35. > 7000 East Ave., L-307          (510) 423-1062
  36. > Livermore, CA 94550
  37.  
  38. I agree that this would be a useful  feature.   However,  it
  39. isn't  quite 100% adequate, because of a little problem with
  40. character values.  The problem:  a  character  variable  may
  41. contain  the  delimiter  character  as  part  or  all of its
  42. content.  The usual solution is  to  package  the  character
  43. fields  in quotation marks, which in turn creates difficulty
  44. if quotation marks appear in  content.   The  convention  to
  45. handle  this  is  doubling of such embedded quotation marks.
  46. So, if we had these three variable in an observation:
  47.  
  48.    var1 (numeric):     126
  49.    var2 (character):   O'Hara, Adam
  50.    var3 (numeric):     621
  51.  
  52. the comma-delimited record should be something like:
  53.  
  54.    126,'O''Hara, Adam',621
  55.  
  56. which consists of just three fields under these conventions.
  57. This  would  require something a bit more elaborate than the
  58. DELIMITER= option.
  59.  
  60. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  61. \   Howard Schreier, U.S. Dept. of Commerce, Washington    /
  62. /                     MVS 5.18 & 6.07                      \
  63. \   Voice: (202) 377-4180        BITNET: HIS@NIHCU         /
  64. /   Fax:   (202) 377-4614      INTERNET: HIS@CU.NIH.GOV    \
  65. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  66.