A Useful Starter Narrative on StatMart

Esp. re: how to copy a sample program and run it on StatMart Logon to Statmart: (you’ll be using SSH Secure Shell Client, the host name is statmart.cc.binghamton.edu) You should see: statmart% as the Statmart command prompt. Next type: pwd To see that the working directory is something like /users/rhansen When you type: ls you may or may not see a list of files (which are already in your personal area on the machine). Note: online documentation is available for more details concerning Unix commands such as ls and pwd. There are two ways to see what is available as samples. We can change the working directory to /data/ECON502/SimpleExamples by typing cd /data/ECON502/SimpleExamples Which then lets us type: ls to see what’s there. Or we can look at the files directly without moving from our home directory by typing: ls /data/ECON502/SimpleExamples The second method is better because we will do most of our work in our home directory (what we first saw after pwd above). If you have changed your working directory (the active directory, or folder). You can return to your home space by typing: cd ~ The tilde (~) is a character found on the upper left corner of your keyboard, below the escape key. You’ll need to hold down the shift key to type it. The tilde (~) refers to your home directory. Other symbols can be used instead of explicitly named directories for all commands that work with directories. For instance: A dot (.) refers to the current working directory. A slash (/) refers to the root directory. Two dots (..) refer to the parent directory, one level up in the hierarchy of directories. Other useful directory commands are: rmdir – to remove a directory. cd – means, change directory mkdir – means make directory (the current directory will become a parent) You can learn more about all Unix commands by typing: man command for example typing: man pwd will tell you what the pwd command does. Press the space bar or q when the computer says More… at the bottom of the screen. So, when we are sure that our current area is the working/active directory we should type: cp /data/ECON502/SimpleExamples/intro.sas. (Note: there is a space and a dot at the end of what we have just typed, and a space between the command cp and the rest of the line. The filename and directories must be spelled accurately and lower and upper case does matter on Unix) cp – means copy file mv – means move file rm – means remove file (i.e. delete it) After we type the long cp command above we can verify it worked by typing: ls which should show the intro.sas file and any other directories or or files we’ve made. We can now change (edit) our local copy of the intro program without disturbing what others on the sytem may want to do with the program. To edit the file (and look at it) we type: pico intro.sas It’s easy to make simple changes to the file using the backspace key to delete parts and by simply typing text we want to insert. Be careful not to remove the important semicolon at the end of most lines, but otherwise try as many changes as you like. More information is available about pico online. Use ctrl-V and ctrl-Y to move down and up in the file without making changes. For now let’s make no changes (except perhaps adding a extra space someplace unimportant) and save our change by typing: ctrl-O Then pressing Enter to verify that we want to write our changes to the file called intro.sas (I.e. the same name it was). You may optionally add Age to one of the var statements before doing this. Then type ctrl-X to exit pico. If you accidentally type ctrl-X to exit pico first without saving, the editor will warn you that you should save the changes you made ‘to the buffer’ (i.e. what you see on the screen). To run intro.sas through SAS and make it do the analysis you type: sas intro or sas intro.sas The computer will usually respond fairly quickly after it has completed the analysis.

Running a SAS program always generates a .log file, which is a log (journal) of what the analysis accomplished. Running the SAS program will hopefully also produce a .lst file. Check to see what SAS has produced by typing: ls intro.* Or just ls If you see only the .log file as a new file, or if you suspect you’ve made errors it’s good to look at the LOG file by typing: pico intro.log or more intro.log Start at the top of this file and watch for lines that begin with ERROR. The first ERRORs are the most important ones because they cause cause problems for later SAS PROC (procedure) steps. After you exited from pico (ctrl-X should work) Look at the listing if you need to make no corrections to the SAS program by typing pico intro.lst To look at the program and make corrections or changes to it. Exit pico (described above) and then type: pico intro.sas Much more can be covered re: SAS and different ways to work in Unix. A useful exercise may include trying the following groups of commands to see what they do (while examining various online documents mentioned elsewhere for SAS and Unix) At various points (when typing out long file names or directory names it will be easier just to start typing the name, then pressing TAB to complete the name). Logout when you finish these exercises. cd /data ls cd /data/ECON502/SimpleExamples ls - cd ~ pwd mkdir ECON502 ls cd ECON502 pwd ls cd .. pwd - pwd ls –l ls /data/ECON502 pwd cd /data/ECON502 pwd ls - cd ~/ECON502 ls cd .. ls rmdir ECON502 ls - pwd cp /data/ECON502/SimpleExamples/IQ.sas. ls cp IQ.sas IQnew.sas ls IQ*.sas ls IQ*.* sas IQ ls IQ*.* more IQ.lst (space bar several times as needed) sas iqnew (note: error message) sas IQnew ls more IQnew.lst (space bar again) rm *.lst ls - cd /data pwd cd ECON502 pwd cd SimpleExamples pwd cd .. pwd cd ~ pwd cd data/ECON502