Thursday, December 21, 2006

Using WinSCP to run SAS programs


In the screenshot of WinSCP, Novell files are on the left, Unix files are on the right. You can drag and drop to transfer files between systems.

  • Create a new SAS program file using WinSCP.
    • From the top menu bar, choose Files/Edit new file.
    • Name it your_pgm.sas. (NB: No spaces allowed in Unix file names.)
  • Edit an existing file using WinSCP.
    • Right click on a file. You will see some preset Unix commands (Edit, Copy, etc.)
    • Choose Edit to edit the file
  • 3 ways to execute SAS as a Unix command through WinSCP
    • From the top menu bar, choose Commands/Terminal. Type sas your_pgm.sas
    • From the top menu bar, choose Options/Command line. In the command line box that appears at the bottom of the window, type sas your_pgm.sas
    • Set up a custom command, as described below
  • Add a SAS command to the custom menu.
    • Right click anywhere on the Unix side of the window.
    • Choose Custom Commands/Customize/Add
    • Enter SAS in the Description box.
    • Enter sas “!” in the Custom Command box
    • The command SAS will be added to the Custom Commands
  • Some useful commands at HSPH. (If you set them up as Custom Commands, you won’t have to remember them.)

Description (becomes the menu choice)

Command (this format for custom commands uses “!” to refer to the file you clicked)

SAS [Version 9]

sas “!”

SAS8 [In case you need V8]

sas8 “!”

mpage [multi-page print in the Microlab to printer L17a (2 pages on one side)]*

mpage –Pmlab58 -2 “!”

lp [stream print to printer LL17a in Microlab]*

lp “!”

SAS Sudaan

sas8 -path /usr/local2/sudaan90/sas-callable "!"

*For best results, set “options linesize=78;” in your SAS program.

  • Run the SAS program using the custom SAS command
    • Click the SAS program file
    • Choose SAS from Custom Commands
    • Select SAS your_pgm.sas and execute
  • Managing your SAS session
    • Use Edit to examine .log and .lst files
    • Use mpage to print .sas, .log, and .lst files
    • If SAS is installed on your PC, consider using it to write your programs using the enhanced SAS editor. Drag and drop your program from the PC side of the window to the Unix side. (Be sure to save the editor contents before you do so). Execute the program using one of the methods, above. Drag and drop your .log file back to PC SAS for viewing in color.

This page was created by Amy Cohen.