home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / bit / listserv / sasl / 5416 < prev    next >
Encoding:
Text File  |  1992-12-17  |  3.8 KB  |  144 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!malgudi.oar.net!news.ysu.edu!psuvm!auvm!FENIX.UB.ES!JUANGRE
  3. Mailer: Elm [revision: 66.25]
  4. Message-ID: <SAS-L%92121717364623@AWIIMC12.IMC.UNIVIE.AC.AT>
  5. Newsgroups: bit.listserv.sas-l
  6. Date:         Thu, 17 Dec 1992 17:33:40 MET
  7. Reply-To:     Juan Gregorio <juangre@FENIX.UB.ES>
  8. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  9. From:         Juan Gregorio <juangre@FENIX.UB.ES>
  10. Subject:      SAS2SPSS EXEC
  11. Comments: To: SAS List <sas-l@awiimc12.bitnet>
  12. Lines: 130
  13.  
  14. Hi net,
  15.  
  16.         After the discussion in this list about transforming SAS data sets to SP
  17. SS, I
  18.  have a program in REXX to make this transformation. I have used the mails
  19.  received in this list, specially one from Melvin Klassen.
  20.  
  21.         I hope this will be useful.
  22.  
  23.         After this signature is the program :
  24. --
  25. +------------------------------------------+----------------------------------+
  26. ! Juan Gregorio de las Heras               ! E-Mail:   juangre@fenix.ub.es    !
  27. ! Informatica de Recerca i Docencia        !                                  !
  28. ! Universitat de Barcelona                 +----------------------------------+
  29. ! Avda. Diagonal 696                       ! voice:    34-3-280-00-18         !
  30. ! 08034 Barcelona -- Spain                 ! fax:      34-3-280-41-60         !
  31. +------------------------------------------+----------------------------------+
  32.  
  33.  
  34. #---- cut here ---------------------------------------------------------------
  35. /*
  36.    JUANGRE de las Heras <juangre@fenix.ub.es>
  37.  
  38.    Transform a V6 SAS data set into a system SPSS file in CMS
  39.  
  40.    This programa uses the program ALTSASV6 from Melvin Klassen
  41.    <KLASSEN@UVVM> to transform our V5 file to V5.18
  42. */
  43. address command
  44. PARSE UPPER ARG FNV6 FTV6 FMV6
  45. call initvars
  46. call header
  47. call V6toV5
  48. call altsasV6
  49. call SAStoSPSS
  50. call theend
  51. exit 0
  52.  
  53. initvars :
  54. if FMV6 = ' ' then FMV6 = '*'
  55. FNV5 = 'SAS2SPSS'
  56. FTV5 = 'TMP'
  57. FMV5 = 'A'
  58. FNSX = FNV6
  59. FTSX = 'SYS'
  60. FMSX = FMV6
  61. FTMP1 = 'TMPV6V5 SAS A'
  62. FTMP2 = 'TMPSPSS SPSS A'
  63. if FNV6 = ' ' | FTV6 = ' ' then call usage
  64. return
  65.  
  66. usage :
  67. say
  68. say 'SAS2SPSS'
  69. say '(c) Juangre de las Heras <juangre@fenix.ub.es>'
  70. say
  71. say 'Transform a V6 SAS data set into a system SPSS file in CMS'
  72. say
  73. say 'Syntax :'
  74. say '         SAS2SPSS <fn> <ft> <fm>'
  75. say
  76. say 'Creates the following files:'
  77. say
  78. say '         'FNV5 FTV5 FMV5 '(SAS data set V5)'
  79. say '         <fn> SYS <fm> (SPSS System file)'
  80. say
  81. exit 1
  82. return
  83.  
  84. header :
  85. say
  86. say 'SAS2SPSS'
  87. say '--------'
  88. say
  89. say 'SAS Library File:' FNV6 FTV6 FMV6
  90. say 'SPSS System File:' FNSX FTSX FMSX
  91. return
  92.  
  93. V6toV5 :
  94. say
  95. say 'Converting V6 to V5 ...'
  96. say 'SAS V5 File:' FNV5 FTV5 FMV5
  97. call write FTMP1, 'libname' FTV5 'V5seq '''FMV5''';'
  98. if rc <> 0 then call sayerror rc, 'Writing temporal file' FTMP1
  99. call write FTMP1, 'data' FTV5'.'FNV5';'
  100. call write FTMP1, 'set' FTV6'.'FNV6';'
  101. call write FTMP1, 'run;'
  102. 'EXEC SAS' FTMP1
  103. oldrc = rc
  104. 'ERASE' FTMP1
  105. if oldrc <> 0 then
  106.    call sayerror oldrc, 'Executing SAS' FTMP1, 'TMPV6V5 SASLOG'
  107. return
  108.  
  109. altsasV6 :
  110. say
  111. say 'Modifying SAS V5 File ...'
  112. 'EXECIO 1 DISKR' FNV5 FTV5 FMV5 '1 ( VAR RECORD1'
  113. if rc <> 0 then call sayerror rc, 'Reading SAS v5 data set' FNV5 FTV5 FMV5
  114. RECORD1 = SUBSTR(RECORD1,1,42) || '85.18' || SUBSTR(RECORD1,48)
  115. 'EXECIO 1 DISKW' FNV5 FTV5 FMV5 '1 ( VAR RECORD1 FINIS'
  116. if rc <> 0 then call sayerror rc, 'Writing in SAS v5 data set' FNV5 FTV5 FMV5
  117. return
  118.  
  119. SAStoSPSS :
  120. say
  121. say 'Converting to SPSS ...'
  122. call write FTMP2, 'get sas data='FTV5'.'FNV5'.'
  123. if rc <> 0 then call sayerror rc, 'Writing temporal file' FTMP2
  124. call write FTMP2, 'save /outfile '''FNSX FTSX FMSX'''.'
  125. 'EXEC SPSSX' FTMP2
  126. oldrc = rc
  127. 'ERASE' FTMP2
  128. if oldrc <> 0 then
  129.   call sayerror oldrc, 'Executing SPSSX' FTMP2, 'TMPSPSS LISTING'
  130. return
  131.  
  132. theEND :
  133. say
  134. say 'Done.'
  135. return
  136.  
  137. sayerror :
  138. parse arg code, msg, file
  139. say 'Error  SAS2SPSS :' msg
  140. if file <> ' ' then
  141.    say 'Look at' file 'for more information'
  142. exit code
  143. return
  144.