A COMPARISON BETWEEN PC SAS and UNIX SAS We Start with a Simple Comparison on General Issues Between PC SAS and UNIX SAS
Total Page:16
File Type:pdf, Size:1020Kb
UNIX Comes to the Rescue: A Comparison between UNIX SAS® and PC SAS® Chii-Dean Lin, San Diego State University, San Diego, CA Ming Ji, San Diego State University, San Diego, CA ABSTRACT Running SAS under PC and under UNIX environment are very similar in general. However, some differences do exist between PC SAS and UNIX SAS. A SAS code may run smoothly under PC SAS but not under UNIX SAS. In this paper, we compare the differences between PC SAS and UNIX SAS. Features that are different between PC SAS and UNIX SAS are summarized. In addition, we show a step-by-step procedure for running a PC created SAS code on a UNIX server. This paper is intended for beginners with basic SAS knowledge. INTRODUCTION “I really need the SAS results by Friday but my PC and my colleagues’ PCs can only get half of them. What should I do?” If you have a UNIX account, one suggestion would be to upload the program(s) to UNIX and run program(s) there. Even if you follow all the necessary rules and procedures of putting SAS program(s) and data sets into UNIX, sometimes the program will not run as smooth as you wish. Generally speaking, PC SAS and UNIX SAS are so similar that people usually are not aware of any problems until they try to execute a PC SAS program on UNIX (or vice versa) and run into trouble. In this paper, we compare differences between PC SAS and UNIX SAS and discuss potential problems when running a PC created SAS program on a UNIX platform. Kutler (2003) discussed the Linux/Unix & X-windows systems for SAS system administrators who would like to implement an open environment within their SAS installation. Zhang (2003) showed how one can use ODS, FTP, DDE, etc for integrating between UNIX & SAS. Our focus of this paper is not, however, to show how to integrate between PC and UNIX using SAS/CONNECT or accessing the interfaces for client/server database systems using SAS/ACCESS. Instead, we emphasize on running a SAS code on either PC or UNIX in a more traditional way: write a program, submit it, and get results. PCs are more powerful and faster than before. Even so, we still receive requests for help from students asking how to run programs such as SAS or S-plus on UNIX due to time limit or memory problem on PC. It is clear that the UNIX platform still holds some edges for running large programs over the PC platform. In this paper, we first compare major differences between PC SAS and UNIX SAS. This gives readers a quick snapshot on how SAS functions under these two systems. After giving a general idea how SAS behaves under PC and UNIX, we provide a detailed illustration on some major issues and provide simple programs for comparison purposes. A step-by-step procedure is provided on how one can run a PC created SAS program using UNIX batch mode and how one can edit the program on UNIX. The procedure gives readers a guideline to run a SAS code from PC SAS to UNIX SAS. Finally, we conclude with a brief discussion. A COMPARISON BETWEEN PC SAS AND UNIX SAS We start with a simple comparison on general issues between PC SAS and UNIX SAS. A summarized table showing the comparisons is listed below. Sample SAS codes used to show the differences are given in the next section. Note that some of the comparisons are based on the windowing environment in PC SAS and on the batch mode in UNIX SAS. Running SAS codes under PC windowing environment and under UNIX batch mode are our major concern. This is because windowing environment is used the most under PC while the background batch mode under UNIX can be used as an alternative option for running a long processing SAS program. Some of the differences listed below may be due to the running modes such as windowing environment and batch mode and not due to the PC SAS and the UNIX SAS environment. Server PC-SAS UNIX-SAS Invoking a SAS session -Windowing environment mode. -Display manager mode (if connects from a PC, -Batch mode. one needs an X Window manager such as XWIN32 to run the Display manager mode). -Non-interactive mode (Batch mode). -Line command mode. Terminating a SAS -Windowing environment mode: All modes: use kill PID under UNIX prompt process Use BREAK icon (circled (See next section for detailed description). exclamation point (!)) or CTRL+BREAK. -Batch mode: Click on cancel icon. Case Sensitive? No The UNIX environment is case sensitive but not 1 the SAS session. File directories and external file names called within SAS are case sensitive. Output & Log file -Windowing environment mode: -Display manager mode: same as PC-SAS. accumulate under the Output -Batch mode: override the existing .lst and .log Window & the Log Window. files when rerun the SAS code unless redirect to -Batch mode: override the existing different files. .lst and .log files when rerun the SAS code. Executing system Yes Yes commands within SAS? Running multiple jobs? Yes. Not efficient. Yes. Batch mode submission allows us to submit many jobs simultaneously. Line width restriction No Yes. The lines that is longer than 135 columns when creating a SAS will be automatically moved to next line. (See code? the example below) The submitted code will Windowing environment mode: the Display manager mode: the SAS code will remain in the Program SAS code will remain in the disappear from the Program Editor window after a Editor under the Display Program Editor window after a submission. Can use RUN --> RECALL LAST manager mode? submission. SUBMIT to recall the submitted SAS code. Methods for submitting Right click on the mouse and Under UNIX prompt, type sas filename.sas a batch mode job: select batch submit icon when &, where filename.sas is the SAS code you like pointing to the SAS program file or to run. drag the SAS program file to the SAS shortcut icon. Page break effect when Windowing environment mode: no Windowing environment mode: no effect (save exporting output files to effect (save from Output Window). from Output Window). other text editing Batch mode: the page break effect Batch mode: the page break effect exists (export software such as exists (export from .lst file). from .lst file). Microsoft Word: The above table provides a quick comparison between PC SAS and UNIX SAS. In this paper, we focus our discussions on running programs using windowing environment on PC and background batch mode on UNIX. The following is a simple SAS code that assigns a new variable based on two existing variables under DATA STEP and under PROC IML. Note that the assignment of z was written in a long line under the SAS Program Editor window. That is, there is no line break as shown here. The same SAS code was uploaded and run under a UNIX environment. Partial log files of the submitted SAS code under a PC SAS environment and under a UNIX SAS environment are shown below. We note that there is no error when the SAS code runs under PC but a syntax error message is issued when the same SAS code runs under UNIX SAS. We notice this same phenomenon under either DATA STEP or PROC IML. data test; x = 5; y = 10; z = x + x + y + x * y + x - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x + y + x * y + x - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x + y + x * y + x - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x + y + x * y + x - y + x + x + x + x +y; run; proc print; run; proc iml; x = 5; y = 10; z = x + x + y + x * y + x - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x + y + x * y + x - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x + y + x * y + x - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x + y + x * y + x - y + x + x + x + x +y; print x y z; quit; run; 2 A partial log file using PC SAS shows no error. NOTE: SAS initialization used: real time 1.90 seconds cpu time 1.85 seconds 1 data test; 2 x = 5; 3 y = 10; 4 5 z = x + x + y + x * y + x - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x + y 5 ! + x * y + x - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x + y + x * y + x 5 ! - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x 6 + y + x * y + x - y + x + x + x + x +y; 7 run; NOTE: The data set WORK.TEST has 1 observation and 3 variables. NOTE: DATA statement used: real time 0.84 seconds cpu time 0.09 seconds If we upload the same SAS code and run under a UNIX platform, a warning message and an error is shown. A partial log file is listed: 1 data test; 2 x = 5; 3 y = 10; 4 WARNING: Truncated record. 5 z = x + x + y + x * y + x - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x + y + x * y + x - y + x + x + 5 ! x + x + y + y/x + x*y + 3 + x + x + y + x +y +x + x + y + x * y + x - y + x + x + x + x + y + y/x + x*y + 3 + x + x + y 5 ! + x +y +x + x 6 run;; ___ ___ ___ 22 22 22 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, LE, LT, MAX, MIN, NE, NG, NL, OR, ^=, |, ||, ~=.