home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / bit / listserv / sasl / 4989 < prev    next >
Encoding:
Text File  |  1992-11-09  |  5.7 KB  |  139 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!stanford.edu!unixhub!fnnews.fnal.gov!overload.lbl.gov!zeus.ieee.org!europa.asd.contel.com!paladin.american.edu!auvm!CTS27.CS.PGE.COM!LAW4
  3. Message-ID: <9211092114.AA06255@csd01.cs.pge.com>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Mon, 9 Nov 1992 11:54:59 PST
  6. Reply-To:     LAW4%RatesRDS%FAR@CTS27.CS.PGE.COM
  7. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. From:         LAW4%RatesRDS%FAR@CTS27.CS.PGE.COM
  9. Subject:      re: Conversion of SAS files to spreadsheet files.
  10. Lines: 127
  11.  
  12. Sigurdur R Saemundsson writes:
  13.  
  14. >I seem to remember that there was a discussion, not so long ago, on
  15. >how to convert SAS files to spreadsheet files. My problem, specifically,
  16. >is to get a PC-SAS file into EXCEL. Can anyone fill me in on this?
  17. >Do I really need some extra software?
  18. ----------------------------------------------------------------------------
  19. You need to have SAS for OS/2 or SAS for Windows to move data directly from
  20. a SAS file into an Excel spreadsheet.  Otherwise you need to use PC-SAS to
  21. create an intermediate file that can be read by Excel, such as a .CSV (comma
  22. separated file created in a DATA step) or a .DBF file (created by PROC DBF).
  23.  
  24. If you have SAS for OS/2 or SAS for Windows, then following is a sequence
  25. of some previous SAS-L messages.  (There is nothing new beyond this point
  26. for those of you who have been following the DDE messages.)
  27. ----------------------------------------------------------------------------
  28. >Now that SAS is 'playing' on PCs in Windows, I'd like to see SI recognize
  29. >those of us who've been working there, using the PC databases available,
  30. >by building interfaces to major PC DBMS software.  dBase IV and Paradox
  31. >come to mind.  And how about the existing spreadsheet?  I know SI would
  32. >like us all to use THEIR spreadsheet, but lets be realistic: Lotus 1-2-3,
  33. >Excel, and Quattro Pro are nice products with large installed bases.
  34. -----------------------------------------------------------------------------
  35. >Have you checked out DDE (Dynamic Data Exchange)?  This will let you exchange
  36. >data with Excel and Lotus 123 as well as other products that support DDE.
  37.  
  38. >Look in:
  39. >1.  SAS Communications, Second Quarter 1991
  40. >2.  SUGI 17 Proceedings, page 117 "Data Exchange Between the SAS System and
  41. >Microsoft Excel"  (I wrote this paper, so it is highly recommended!)  This
  42. >paper was written using SAS for OS/2, but DDE is supposed to work the
  43. >same way under Windows.
  44.  
  45. >I don't have SAS for Windows yet, so I can't tell you what page to look up in
  46. >the Companion manual, but I'm sure DDE is in there somewhere.  Good luck!
  47.  
  48. Louise Weiler
  49. ----------------------------------------------------------------------------
  50. >And to further the cause:
  51.  
  52. >Yes INDEEDY, DDE does work with Windows SAS Release 6.08 (BETA),  as we have
  53. >successfully linked EXCEL spreadsheets and SAS data.  OLE (Object Linking and
  54. >Embedding) which is even more powerful, is documented in the BETA manuals as
  55. >well.
  56.  
  57. >There appears to be plans for a .DBF and .DIF SAS/ACCESS product (not much in
  58. >the HELP library on these yet) complete with a DBLOAD procedure for those of
  59. >you xBASE junkies.
  60.  
  61. >Intel-Insider,
  62.  
  63. >Tom Skinner
  64. -----------------------------------------------------------------------------
  65. Jack Shoemaker wrote:
  66.  
  67. >The SAS manual says that the DDE channel is tab-delimited.  I have found this
  68. >NOT to be the case attempting to read an Excel spreadsheet.  For example:
  69.  
  70. >EXCEL SPREADSHEET:  (small.xls)
  71. >        A       B       C
  72. >1     Jack  North Haven Red Sox
  73. >2     Dean  Ridgefield  Yankees
  74. >3     Will  Brookfield  Mets
  75.  
  76. >SAS CODE:
  77.  
  78. >filename inx dde 'excel|small.xls!r1c1:r3c3';
  79.  
  80. >data inx;
  81. >infile inx dsd truncover;
  82. >input guy $ town $ team $;
  83. >run;
  84.  
  85. >proc print data = inx;
  86. >run;
  87.  
  88. >SAS OUTPUT:
  89.  
  90. >GUY  TOWN     TEAM
  91. >Jack North    Haven
  92. >Dean Ridgefie Yankees
  93. >Will Brookfie Mets
  94.  
  95. >Further inspection of the DDE channel using the PUT command with $HEXw. format
  96. >revealed that the channel was blank-delimited.  That's why `Haven' ended up in
  97. >the TEAM field instead of part of the TOWN field.
  98.  
  99. >I believe that we set WINCHARSET to OEM in our configuartion file - I forget
  100. >and can't check right now.  I did use both the OEM and ANSI modifiers on the
  101. >filename statement, but got the same results.
  102.  
  103. >Comments?  TIA - Jack
  104. >--
  105. >Jack Shoemaker
  106. >Real Decisions Corporation    Voice: 203-656-1500
  107. >Darien, CT  06820          InterNet: shoe@world.std.com
  108. ----------------------------------------------------------------------------
  109. I wrote:
  110.  
  111. >Try out the following: Put a DELIMITER='09'X option in your INFILE statement
  112. >and a NOTAB option in the FILENAME statement.  Now the SAS code should read:
  113.  
  114. >       filename inx dde 'excel|small.xls!r1c1:r3c3' notab;
  115.  
  116. >       data inx;
  117. >       infile inx delimiter='09'x;
  118. >       input guy $ town $ team $;
  119. >       run;
  120.  
  121. >This ought to work.  You might need to put in a length statement for your
  122. >character varaibles.  Sorry, but I don't know what DSD and TRUNCOVER mean,
  123. >so I've left them out.
  124. ---------------------------------------------------------------------------
  125. Then I added:
  126.  
  127. >I neglected to say why I thought this would work.  By default, when SAS
  128. >receives data from Excel, the tabs that Excel uses to delimit columns are
  129. >converted to blanks.  The NOTAB option in the FILENAME statement tells SAS
  130. >not to convert tabs to blanks.  When the NOTAB option is used, you must then
  131. >tell SAS to recognize that tabs are the delimiter in the INFILE statement.
  132. --------------------------------------------------------------------------
  133. Louise Weiler                           INTERNET: law4@cs.pge.com
  134. Pacific Gas and Electric Company        VOICE:  415/973-1355
  135. Rates Dept. B10B                        FAX:    415/973-7451
  136. P.O. Box 770000
  137. San Francisco CA 94177
  138. ---------------------------------------------------------------------------
  139.