240 likes | 364 Views
Transferring VMS SAS/SPSS Data to UNIX. Jeff Hayes Social Science Computing Co-op February 26, 1999. Problem. SAS and SPSS data sets are stored in binary Binary representations differ across operating systems (VMS and UNIX). Don’t forget….
E N D
Transferring VMS SAS/SPSS Data to UNIX Jeff Hayes Social Science Computing Co-op February 26, 1999
Problem • SAS and SPSS data sets are stored in binary • Binary representations differ across operating systems (VMS and UNIX)
Don’t forget… • About your files on VMS tapes. Files stored as SAS or SPSS data sets on tape need to be transported • For SPSS, data sets need to be based on SPSS version 4 or later
Steps to transfer data • Exporting the data set(s) on VMS (Run some descriptives!) • FTPing the data to UNIX • SPSS portable files as ASCII • SAS transport files as binary • Importing the data set(s) on UNIX (Re-run the descriptives and check the data!)
UNIX disk allocations • Most users have only one account on UNIX • /home - limited to 100 MB. Intended for mail and program files • /aux - limit varies 200-500 MB. (See consultant.) Intended to hold user data files • /temp/fivedays - limited by usage (disk is 4 GB)
Use compressed files on UNIX • Compressed files can greatly reduce the amount of disk space your files take up • SAS and SPSS can read compressed transportable files directly. See: • SSCC How to… #1 How to Write/Read UNIX Compressed SAS Data Sets Directly • SSCC Publication 7-7 Using SPSS on UNIX
Translation tools • SSCC has two utilities that can read the SPSS/SAS transportable files and write files for many different software packages, e.g. Stata, Limdep, and Excel. • Stat/Transfer (WinCenter, available to any PC in Social Science building) • DBMS/Copy (UNIX, X windows required for graphical interface)
SPSS: Exporting data • Use a GET command to identify the data set you wish to transfer • Use an EXPORT command to create the portable file. (Recommend .por extension) • Run descriptive statistics for verifying data transfer’s success
SPSS: FTP the data • Login to UNIX and get to the directory where you want the data to end up • Start FTP (ftp eagle) and login to Eagle • get staffdisk2:[100041.spss]gss7296.por gss7296.por • When completed, type “quit” to exit FTP
SPSS: Importing data • Use an IMPORT command to read the portable file on UNIX • If you wish, you can use a SAVE command to create a SPSS system file • Re-run the descriptive statistics to compare to results on VMS
SPSS: Conclusions • Consider keeping your data in a SPSS portable file. It’s easy to read in SPSS on UNIX or a PC. It can also be transferred to another package, such as Stata, using Stat/Transfer or DBMS/Copy • When transferring SPSS portable files, use FTP in ASCII mode (default between VMS and UNIX)
SAS: Exporting data I: Libnames • Use a LIBNAME statement with the xport engine and the cc=none option to identify the transport file to be created • libname moveout xport “staffdisk:[100041.sas]gss.xpt” cc=none;
SAS: Exporting data I: Libnames • Use a LIBNAME statement to identify the directory containing the SAS data set to be exported • libname movein “staffdisk2:[100041.sas]”;
SAS: Exporting data II: PROC COPY • Use PROC COPY to create a transport file from a SAS system file or library • proc copy in=movein out=moveout; select gss7296;
SAS: Exporting data II: PROC COPY • The SELECT subcommand copies only the file named to the transport file • Omitting the SELECT subcommand will create a transport file containing all of the SAS data sets in the specified directory. PLEASE DON’T. Such a file can be too large. Use SSCC How to… #7 How to Write a Macro to Transport SAS Data Sets from VMS to UNIX to transfer many files.
SAS: FTP the data • Login to UNIX and get to the directory where you want the data to end up • Start FTP (ftp eagle) and login to Eagle • Type binary to specify that the transport file will be transferred in binary mode • get staffdisk2:[100041.sas]gss7296.xpt gss7296.xpt • When completed, type “quit” to exit FTP
SAS: Importing data I: Libnames • Use a LIBNAME statement with the xport engine to identify the transport file to be read • libname moveout xport “/aux/j/jhayes/sas/gss7296.xpt”;
SAS: Importing data I: Libnames • Use a LIBNAME statement to identify the directory to save the imported SAS data set • libname movein “/aux/j/jhayes/sas”;
SAS: Importing data II: PROC COPY • Use PROC COPY to create a SAS system file or library from a transport file • proc copy in=moveout out=movein; select gss7296; • The SELECT subcommand must refer to the exact name specified in the PROC COPY/SELECT on VMS
SAS: Conclusions • FTP transport files in binary mode. (ASCII is the default between VMS and UNIX) • Consider keeping your data in a SAS transport file. They can be compressed and read directly by SAS. • SAS transport files can also be transferred to another package, such as Stata, using Stat/Transfer or DBMS/Copy
SAS: New developments • Starting with version 7, SAS data sets (referred to as “tables”) will be platform independent • Watch SSCNews for an announcement that version 7 is available on VMS and UNIX with new SSCC publications available
Clean-up and Back-up! • Get rid of out-of-date, unneeded files before you start this process • Please back-up intermediate (.por or .xpt) files or those you are not actively using to tape (4mm or 8mm) or CD and store them off-line
Compress! Compress! Compress! • > compress gss7296.por reduces disk space used from 1,603,962 to 443,545 • > compress gss7296.xpt reduces disk space used from 5,648,960 to 565,812
Good luck! • Problems? Send log files to consultant@ssc.wisc.edu or stop by during office hours • Contact consultant early to request SSCC staff assistance in transferring all VMS files to UNIX.