UNIVERSITY OF CALIFORNIA, LOS ANGELES

Department of Economics

HOW TO RUN BASIC TYPES OF SHAZAM PROGRAMS

ON THE SOCIAL SCIENCES COMPUTING NETWORK

NOTE: These instructions are always subject to revision with changes in the setup of these systems or with newer versions of SHAZAM. Some major changes have just been implemented, due to UCLA's recent upgrade to SHAZAM 8.0, and SSC's summer 1997 move to the Public Policy Building.

PUBLIC POLICY BUILDING/BUNCHE LAB NETWORK MICROCOMPUTER SHAZAM

Getting Started

  1. Turn on your machine. There is an POWER switch on the central processing unit (under the table on the left), and one on the monitor (the screen, on the bottom right on the front of the MAG monitors in the lab). The system will go through a number of checks, including a virus scan. Eventually, it will show a login screen. Type your two-letter, six digit "Name", tab down to the next field and type your password, which defaults to "password".

  2. You will then see a screen with assorted program icons, and the "SSC Apps" folder will be open. There are a couple of preliminaries to take care of. First, find the icon for changing your password. Think up a new password that is not obvious to anyone, effect the change, and return to the SSC Apps folder.

  3. Now, it is wise to set your default printer. Double-click on the icon for "My Computer." Double-click on Printers. Right-click on "Text-Only Dot Matrix," and select "Set as Default."

  4. Now, double-click on the icon for "Classes." Then double- click on the icon for "Econ 143." You are now in a folder that contains all the main programs for the course, sorted in alphabetical order.

  5. [NOTE: You cannot store programs, additional data, or output files on the network. Files stored on the c: drive of lab machines will stay there until someone deletes them or writes over them, but reside only on that particular CPU. You will generally bring a 3.5" diskette with you to work in the lab. Place it in the a: drive and direct all reading and writing commands to files prefaced by this a: drive identifier. During orientation, if you do not have a diskette, direct all writing to the main directory of the c: drive, using the c:\ prefix on your filenames.]

  6. Most diskettes now come pre-formatted. However, if yours is unformatted, the first time you use a 3.5" diskette, you will need to format it to receive data. This wipes out anything presently on the disk, so do not do this again to the same disk unless you really want to eliminate all information on it. If formatting is necessary, double-click on the "My Computer" icon, right-click on "3 1/2 Floppy (A:)", and select "format."

Running SHAZAM

  1. You are now ready to run SHAZAM interactively. Return to the Econ 143 folder and double-click on the "SHAZAM for DOS" icon. (SHAZAM for Windows is in Beta- test editions, but still seems to have a couple of bugs.) You will then see a menu that allows you to "Run SHAZAM", "Run SHAZAM with a PAR value" (for larger programs), or "exit."

  2. Touch 1 to run SHAZAM. For a demonstration of several of the capabilities of the program, you could now opt to run the SHAZAM demo program. When SHAZAM runs through all of its proprietary information, it will ask you to enter a command. All you would do at this point is to type in demo and hit Enter. The command stop will usually get you out of SHAZAM and back to the network F prompt.

  3. You can also write and run your own SHAZAM program. From the Econ 143 folder, double-click on "SHAZAM for DOS" again, select option 1 to "Run SHAZAM", and you will be ready to run a program "interactively."

  4. Now you will construct a sample of three observations of data on two variables, y and x, plot them, compute descriptive statistics, and regress y on x in the type of Ordinary Least Squares (OLS) regression you will be doing a lot this quarter. When SHAZAM gives you the prompt :TYPE COMMAND , you should enter the following lines of code (hitting enter at the end of each line):

  5. sample 1 3
    read y x
    10 2
    8 4
    6 1
    plot y x
    stat
    ols y x
  6. The output for this program will be produced as you go along. It is "gone forever" when you are done (although the program will let you avoid this--more later). When you want to change something in the program you pretty much have to start all over again. This can be inconvenient, expecially for larger samples of data. Type stop if you have not already done so.

  7. If you want to use the same data set over and over again, you can run a SHAZAM program interactively, but read in the data from a separate file. DOS-based microcomputer filenames typically have two parts: filename.ext. The filename can be anything up to 8 letters, usually starting with a letter. The extension part usually conveys something about what is in the file. It will be handy to use filename.dat for files which contain data and filename.sha for files that contain SHAZAM commands, when we get to that stage. For homework assignments, you might want to use filenames that identify homework sets and questions, such as ps1q2.sha for the SHAZAM commands relevant to Problem Set #1, Question 2.

  8. There is a file containing 10 observations on consumption and income residing on the network drive. The filename is therefore n:cons.dat. The n: drive contains shared files read-only accessible to anyone using SHAZAM on the network. To read and plot these data, create an average consumption variable (and plot it), run descriptive statistics, and to regress consumption on income, you might use the following command sequence (of course, after you have double-clicked on the "SHAZAM for DOS" icon and selected "Run SHAZAM" to get into the program itself).

  9. sample 1 10
    read(n:cons.dat) cons inc
    plot cons inc
    stat
    * pause
    genr avcons=cons/inc
    plot avcons inc
    ols cons inc
  10. This program and its output again exist only while you are running it and will disappear forever when you are done (although the data will still be there). Type stop when you are done.

  11. If you want to write a program that will remain a file for later use or modification, you can create your own file and run SHAZAM from the file, rather than from screen commands. To do this, you will need to use one of the editing programs (TED is recommended--its icon is in the Econ 143 folder. SSC has also provided a Notepad icon, but we have experienced problems with this program's insistence on appending a .txt extension to all filenames. For this reason, TED is preferred). If you are working on your own computer, feel free to use any word-processing program (such as Microsoft Word, WordPerfect, etc.). Just be sure that the file is eventually saved as a flat DOS or ASCII file without any special word-processing formatting characters embedded in the text of the file.

Editing with TED

  1. Double-click on the TED icon in the Econ 143 folder and select the appropriate task--either modifying an old file, or creating a new file and saving it. Choose 1 to create a new file. (If you choose 2, you will be prompted to give the name of an existing file, including the appropriate drive and directory. For example: a:cons.sha)

  2. You will get a screen showing the contents of the existing file, or an empty screen for a new file. Start typing, hitting Enter at the end of each line. The keywords at the bottom of the screen refer to the F keys on the standard microcomputer keyboard.

  3. BE SURE that you enter a "hard" carriage return (enter) after typing the last line in your file. The cursor should be in the first column of the next empty line before you exit from TED, or SHAZAM may not interpret and process the last line of your program.

  4. Choose function key F7 to save and exit from the file (or F1 if you messed up and want to exit without saving). When you type the filename, be sure you have not inadvertently entered an extra space before the name of the file. If you do, TED will refuse to save the file, and will not explain why.

Running a SHAZAM program from a file

  1. Now you can execute your saved SHAZAM program by simply double-clicking on the "SHAZAM for DOS" icon, choosing 1 for "Run SHAZAM" and entering the following command (if you have selected the a: drive for your session):

  2. file 5 a:cons.sha
  3. The number 5 is the fortran "logical unit" (or address) from which SHAZAM always reads input commands. This statement tells SHAZAM that the commands in a:cons.sha should be read and processed.

  4. The output generated by running this program will appear on your screen. Your data and your program will continue to exist, and your program can be modified by returning to TED, but your output is gone forever. Type stop when you are done.

  5. NOTE: If you have created your own data file, rather than using one I have prepared for you, you can edit the data file, as necessary. Data files can be created and edited the same way as command files. If you want to copy a protected datafile or a protected program file from the n: drive, you can use TED to retrieve a copy of the file, edit it, and save it to the a: or c: drive (under the same filename, or a different filename).

  6. Getting a printout of your SHAZAM output requires that you rerun a successful program with an additional command. By default, unit 6 is set to the screen, so that output from each command appears on the screen directly as it is produced. When you are happy with how your program is running, get back to the SHAZAM menu and select TED to edit your command file. Include a line that reads file 6 a:filename.out. BE CAREFUL not to mistakenly type a:filename.sha, since this will overwrite your program file. You will have to copy and re-edit the last version of your program file (if there was one) saved by TED in a:filename.bak. Also, remove the comment character (*) from the *pause statement.

  7. When you have saved the edited version of the file, go back to the Econ 143 folder and double-click on "SHAZAM for DOS" again. Select "Run SHAZAM", and tell it to run your program (with the same command as before). It will notify you that your output file does not exist, so it has created one by that name. As of the execution of that command, however, all subsequent output from the program will be diverted to the file, rather to the screen. After a short time (when the status light on the CPU stops flickering), you can assume that the program is done and type stop if this command was not included at the end of your program file.

  8. You may use TED to view the output file to see if it contains what you expected. If everything is fine, it is time to print a paper copy of the program output. The best way to do this is to open the output file using Notepad. (Unfortunately, the Print option in TED (F3) does not work on the network.) Open Notepad by double-clicking on the Notepad icon, selecting file, and choosing open. Specify the a:\ drive (if this is where you have been sending your files) and be sure that Notepad is looking for "all files *.*". Click on the filename of the program, which is probably a:cons.sha. Once you can see the desired output, and have previewed it for correctness, select FILE, and then PRINT. If you have set the Dot-Matrix printer as your default, that is where the output will go. Dot-matrix output is fine for homework assignments, providing it is legible.

  9. If you wish to make a copy of a network (n: drive) data or program file to take to another location, you should double-click on the notepad icon in the Econ 143 folder, open the file on the n: drive, and then save it to a file with the same name on your a: diskette.

  10. Note: For very large problems, SHAZAM will sometimes cease execution and inform the user how much PAR is necessary to execute the task in question. If this happens, choose option 2 on the SHAZAM menu (Run SHAZAM with a par value) that is presented when you double-click on "SHAZAM for DOS." This will let you set a higher par value. Exercises during introductory courses should not be constrained by the PAR limitations of the networked version.

  11. What is the easiest solution if you run a program that creates an output file that is too large to be perused of edited using TED? Insert a second, different file 6 progname.out command about half way through your command program. Then you will have two output files, one for the first half of the program and another for the second, that will probably fit into the TED editor. If you are working at home, and using your own word-processor, you will probably not be constrained.

  12. Keep us informed as to whether there are problems with these instructions. Careful advance planning of the programs you plan to use will save you many mistakes in the lab. It will also conserve use time and reduce congestion.

Getting nice plots

  1. If you use a plot y x command in SHAZAM, you will get very crude plots. Sometimes, the resolution in these plots is insufficient to allow you to really see what is going on in the data. If you would like nicer laser-printed graphics plots, you may try the following strategy.

  2. Use a plot command of the form
    plot y x / gnu line commfile=test.gnu datafile=test.dat
    Note that the commfile filename cannot be more than 8 characters in total, nor can the datafile filename. This effectively limits you to a four-character filename, if you are going to use the .gnu extension and the .dat extension.

  3. Use TED to peek into the one-line test.gnu file that is created by a plot y x / gnu command. You will see that this file merely points to another, automatically named, gnuplot program file, which will have an uninformative name something like C001.gnu. If you want to embellish your gnuplot plot with a title and extended variable labels, you need to edit this C001.gnu file (or whatever filename is indicated in your one-line test.gnu file). Use TED, and experiment with adding a plot title within the ".." of the TITLE command. Expand upon the names of the variables and upon the labels for each line, if you like. For example, you might add a title that contains your name, so that nobody else will pick up your plot from the printer, mistaking it for their own. Save the edited gnuplot program without changing its name.

  4. To build the fancy plot, from the Econ 143 folder, double-click on the GNUPLOT for Windows icon. Click on OPEN, and choose the file test.gnu. Your plot will appear on the screen. If you don't like something about it, return to TED and continue editing the hidden ****.gnu program file, as before. If you like it the way it is, right-click on the plot and select Print. Make sure the printer is set to the HP Laser 5/5M-standard. You will need money in a laser- printer account ($.10 per page). Your laser plot will be printed outside the lab on the laser-printer across from the Help Desk.

Downloading data and program fragments from the Web

  1. From the main collection of icons, double-click on the Netscape icon.

  2. Find the URL of the page you want to download.

  3. Click on "File", then "Save As...". To preserve the same html filename (usually e143xxxx.htm), just insert an a: (or c:\) in front of the current filename to make a copy on your own diskette or hard drive. Jot down the name(s) of the *.htm files you have downloaded (and the *.sha or *.dat files they are intended to become).

  4. Use TED to load the *.htm version of the file, and follow instructions to delete all of the HTML code from the top and the bottom of the file. Usually, you want to delete everything down to the pre command, and then from the /pre command to the end.

  5. TED will then allow you to save the cleaned up file with an arbitrary filename and extension. Use the recommended *.sha or *.dat filename.

NOTE: These instructions are our first attempt at explaining how to run SHAZAM in the newly configured Public Policy Building SSC lab. With feedback, we will undoubtedly be able to make them clearer. You may also be sufficiently adept to see easier ways to accomplish some of these tasks. Please draw them to our attention, and will share them. Thanks for your patience.

Getting your own copy of SHAZAM

  1. The process of running SHAZAM is markedly simplified if you obtain your own free version of the software and run it on stand-alone PC equipment. To obtain the software, you must bring 2 formatted high-density 3.5" diskettes to the labs in 2035 Public Policy Building.

  2. From the screen containing the general collection of icons, select MS-DOS. From the DOS prompt, issue the command SHAZCOPY, and follow directions. To replicate what you have been working with in the SSC lab, you need the DOS version of SHAZAM, not the Windows version. The Windows version is still in the beta-test stages.

  3. If you have older equipment, limited RAM, equipment without a math coprocessor, or equipment using 5.25" diskettes, you may be able to get SHAZAM to run, but it may require a little extra effort.

  4. Note that even if you get your own copy of SHAZAM, you will still have to visit SSC (or the class web site) to download copies of the relevant data sets for the current homework.



COURSE OUTLINE LECTURE OUTLINES PROBLEM SETS PROBLEM SOLUTIONS COMPUTER LABS
SHAZAM EXAMPLES DATA SETS ONLINE QUIZZES GRAPHICS HANDOUTS

Updated: January 20, 1998
Prepared by: Trudy Ann Cameron