2011-2012 Using Stat/Transfer on the Linux/UNIX Systems Stanford University provides Linux computing resources, which can be accessed through the Stanford University Network (SUNet). The Stanford UNIX system is in fact implemented in the Linux operating system and the two terms are used interchangeably. This document provides a basic overview of the Stat/Transfer data analysis package that is running on the Linux Systems. Stat/Transfer is a program that converts data files between different database management systems, spreadsheets, statistical packages, and other application packages. You must have a SUNet ID (Stanford University Network Identifier) to use the Stanford Linux Systems. See the following URL for information on obtaining a SUNet ID: http://www.stanford.edu/group/itss/services/sunetid For basic information on using Linux/UNIX, such as selecting the right server, security considerations, and frequently used UNIX commands, visit the ITS site: http://www.stanford.edu/services/unixcomputing/ Stanford ITS also provide instructions on logging in to Linux servers: https://itservices.stanford.edu/service/unixcomputing/unix/loggingin Table of Contents Before You Begin... 1 Running Stat/Transfer in Interactive Mode... 2 Within Interactive Stat/Transfer... 2 At the Linux Prompt.... 3 Running Stat/Transfer in Batch Mode... 3 For More Information and Assistance.... 3 Stat/Transfer Assistance... 3 Help Menu... 3 Help with the Linux/UNIX Systems... 4 SSDS Software Services at Stanford.... 4 Appendix... 5 Commonly Used File Extensions... 5 Before You Begin Currently Stat/Transfer version 10.1 runs on the Linux systems. You can run Stat/Transfer interactively and in batch mode, as described below. In the sample command lines in this document this style represents Stat/Transfer or system words, which should not be changed. Words in italics are example names and should be Stanford University Social Science Data and Software
substituted with your actual file names. For illustrative purposes, this document assumes that you are working on myth6, either at a workstation in Terman or by having logged on remotely. Therefore, the Linux prompt throughout the document will be shown as myth6>. As you would for any software hosted on the Linux server, you can begin by setting your desired working directory: cd directory Note: You can repeat this command while in Stat/Transfer Interactive Mode. Running Stat/Transfer in Interactive Mode Within Interactive Stat/Transfer Stat/Transfer can be run interactively from the Linux prompt by typing the following at the UNIX prompt and pressing return: myth6> st Once you are in Stat/Transfer, commands are issued at the st prompt. You can exit Stat/Transfer by typing quit, or just the letter q. st> quit Stat/Transfer Help Menu The help menu is very well organized. You start it by typing help at the prompt. Then, follow the instructions: by typing help commands you will receive information about which Stat/Transfer commands are available. For more information on a given command, type help, followed by the command name, for example: myth6> help copy This will give additional information about the copy command. For a description of the file formats Stat/Transfer accepts and their corresponding extensions, type help formats (some commonly used extensions are also listed in the appendix of this text). Transferring data To transfer data from one format to another, use the command: st> copy in.ext1 out.ext2 The data in file in.ext1 (in the format corresponding to ext1) will be copied into the file out.ext2 in the format corresponding to ext2. For example, to transfer the data from file filename.sas7bdat (SAS version 8.0) to filename.dta (STATA), type the following command: st> copy filename.sas7bdat filename.dta 2 Using Stat/Transfer on the Linux/UNIX Systems
At the Linux/UNIX Prompt Another way of using Stat/Transfer interactively is to type commands directly at the UNIX prompt. This method is useful if you have only one command and you are sure of its syntax. For example, to complete the same transfer as in the last section, type at the UNIX prompt: myth6> st filename.sas7bdat filename.dta This will do in one step what you did in two in the last section (entering Stat/Transfer and then using the copy command). Note: you do not need to include the word copy here; Stat/Transfer will copy by default. Running Stat/Transfer in Batch Mode Stat/Transfer can be run in batch mode. Batch mode involves writing a text file using a text editor, such as Emacs or Pico 1, and then submitting the commands contained in the text file to Stat/Transfer. Batch mode is convenient because programs can be saved and edited for future use and several conversions can be run in the same program. To submit the commands to Stat/Transfer, type the following at the Linux prompt: myth6> st filename.stc Then press return. When you create your text file, be sure to give it the extension.stc. It is the only file extension accepted by Stat/Transfer. filename.stc is the name of a batch text file containing Stat/Transfer commands called "statements." An example batch text file is provided below. Statements specify the input and output files, selections of records and variables, and computation of new variables. Put one statement in each line. An unlimited number of lines can be included in the same batch file. A simple batch file, containing two lines, could look like this: copy filename.sas7bdat filename.dta copy filename.sas7bdat filename1.por This program will convert the SAS version8 (.sas7bdat) file called filename into a STATA (.dta) file called filename and into an SPSS portable file (.por) called filename1. See the Appendix for a list of extensions for the most commonly used software. Once the program finishes running, the files filename.dta and filename1.por will be in your working directory. To specify a subdirectory, you must type the full path name in front of the filename. 1 Another option is to write the text file on your personal computer in your favorite text editor, such as TextEdit, TextPad, or WordPad, and then upload it to your afs space. 3 Using Stat/Transfer on the Linux/UNIX Systems
The comments on the session you just ran will appear directly at the Linux prompt and not in a new file. These comments can be general remarks (such as the number of observations transferred) or error messages. If you get an error message and want to correct the file you submitted, you first of all need to quit Stat/Transfer by typing at the prompt: st> quit After quitting Stat/Transfer, you can correct your file in the text editor of your choice, then submit and run the corrected program. For More Information and Assistance Stat/Transfer Assistance To learn more about the features of this software package and to find out the syntax of specific statements, consult the Stat/Transfer manuals, available in the Velma Denning Room (Room 120F) in the Bing Wing of Green Library. The software consultants at Social Science Data and Software (SSDS) provide technical assistance for Stat/Transfer users at Stanford. Users can send questions to SSDS Software Services by sending email via our web page or can come to the Velma Denning Room (120F) of the Social Sciences Resource Center in the Bing Wing of Green Library during walk- in hours; no appointment is necessary. Current walk-in hours are listed on the SSDS web page at: http://ssds.stanford.edu. Help Menu Remember that the Stat/Transfer help menu that can be accessed on the Linux system and is very well organized (see above). To access the menu, enter interactive Stat/Transfer by typing st at the Linux prompt, then type help at the st prompt. Help with the Linux/UNIX Systems If you have questions about using the Linux Systems, send email to Stanford University s Help Desk via their web page, http://helpsu.stanford.edu. SSDS Software Services at Stanford Software Services provides technical support for statistical software users at Stanford. Users can ask questions or make appointments with the consultants via our website. For more information or to contact us, see the web at: http://ssds.stanford.edu/ 4 Using Stat/Transfer on the Linux/UNIX Systems
Appendix Commonly Used File Extensions This is a list of extensions for the most commonly used statistical and database packages. For the full list of supported packages and their pseudo-extensions, consult Stat/Transfer manuals located in the Velma Denning Room (Room 120F) of the Social Sciences Resource Center in Green Library s Bing Wing. Software Product DBaseIV Excel, pre-2007 Excel 2007 Gauss Limdep for Windows Matlab Minitab for UNIX SAS Transport File SAS Data File version 7/8 SAS Data File Windows/OS2 SPSS Portable SPSS for Windows SPSS for UNIX Stata IC and Stata SE ASCII text file ASCII text file, comma delimited JMP Extension.dbf.xls.xlsx.dat.lpj.mat.mtw.xpt,.tpt.sas7bdat,.sd7.sd2.por.sav.sav.dta.txt.csv.jmp Please note: 1. For S-PLUS file names, since they have no extensions, a period must be added at the end. For example, to transfer the S-PLUS file filename to the SPSS portable file filename1, type: st> copy filename. filename1.por 2. Currently on the Stanford servers, the default version of Stata is version 10. To convert to another version of Stata, use the v flag. For example, to convert a.csv file to Stata version 9, use: st> copy filename.csv filename.dta v9 Copyright 2011 by The Board of Trustees of the Leland Stanford Junior University. Permission granted to copy for non-commercial purposes, provided we receive acknowledgment and a copy of the document in which our material appears. No right is granted to quote from or use any material in this document for purposes of promoting any product or service. Social Science Data and Software Document revised: 9/21/2011 5 Using Stat/Transfer on the Linux/UNIX Systems