UNIVERSITY OF CALIFORNIA, LOS ANGELES
Department of Economics
HOW TO RUN BASIC TYPES OF
"SHAZAM for Windows" 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 for Windows. In past quarters, we used
the DOS version of this program.
PUBLIC POLICY BUILDING/BUNCHE LAB NETWORK MICROCOMPUTER
SHAZAM
Getting Started
-
Turn on your machine (or verify that it is already running). There is a
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 "joebruin".
-
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.
-
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."
-
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.
-
[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.]
-
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
-
You are now ready to run SHAZAM 8.0 for Windows. Return to the Econ 143
folder and double-click on the "SHAZAM for Windows" icon. This should get
you to the SHAZAM window. You should see two open windows.
The top on will be an interactive SHAZAM window, with the cursor blinking
just below a line that says "TYPE COMMAND". Underneath should be
a window entitles "Editor."
-
From the menu across the top of the SHAZAM for Windows screen, select Window,
and then choose "Tile horizontally." (This is a matter of taste;
you are free to arrange your windows however you please.) If you are reading
these instructions from a printed sheet, you may want to maximize the SHAZAM
window by clicking the maximize button on the top right corner of your
screen. If you are reading these instructions from an Internet browser
window, move and resize the SHAZAM window and its constituent windows to
fit on one side of the screen, and resize the browser window with these
instructions to fit on the other side. However, since we will be
restarting SHAZAM during this introduction, it may be easier just to alternate
between the maximized SHAZAM window and the browser window by using the
buttons across the bottom of your screen.
-
For a demonstration of several of the capabilities of the program, you
could now opt to run the SHAZAM demo program. Activate the SHAZAM window
and be sure that the cursor is blinking on the line following the "TYPE
COMMAND" line. All you would do at this point is to type in demo
and hit Enter. It is helpful to be able to take notes as you run through
this demo. Keep in mind that the demo presumes that the user is already
familiar with the material we will be learning in this course, so it is
really somewhat too advanced for our purposes. Do the demo if you
like. Otherwise, exit SHAZAM by clicking the "x" in the upper
right corner of the SHAZAM window.
-
You can also write and run your own SHAZAM program. From the Econ 143 folder,
double-click on "SHAZAM for Windows" again, and you will be ready to run
a program "interactively" with input entered a line at a time from the
screen.
-
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):
sample 1 3
read y x
10 2
8 4
6 1
plot y x
stat
ols y x
-
The output for this program (when any is expected) will be produced as
you go along. You may wish to resize the window to see as much as
possible. However, when you want to change something in the program
you usually have to pretty much start all over again. This can be inconvenient,
expecially for larger samples of data. Exit the program by clicking on
the x in the upper corner of the SHAZAM window and going back to the Econ
143 folder.
-
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.
Microcomputer filenames typically have two parts: filename.ext. The extension
part (.ext) 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.
-
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 Windows" icon and activated
the SHAZAM interactive program window).
sample 1 10
read(n:cons.dat) cons inc
plot cons inc
stat
genr avcons=cons/inc
plot avcons inc
ols cons inc
-
This program again exists only while you are running it. If you want
to save the "conversation" you have had with shazam, you can click on File/Save
or File/Save As.. and you can then save the input/output file to a particular
filename on whatever drive and in whatever folder you choose. However,
it will still be a bit tedious to replicate the program, as you would have
to edit all except the command lines out of the file that you have saved.
There is a better way.
-
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 an editing
programs (SHAZAM provides an internal editor. The "tiny editor" TED
is also available--its icon is in the Econ 143 folder. SSC has also provided
a Notepad icon. Notepad is preferred for printing the final versions
of files, since it allows the margins to be expanded so that there is no
annoying wraparound. However, you may be bothered by Notepad's insistence
on appending a .txt extension to some filenames. This can be changed by
right-clicking on the offending filename and choosing Rename. 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.
This does not matter for output files, which will only be printed, but
matters very much for SHAZAM program and data files.
Editing within SHAZAM
-
In the "Editor" window, begin typing the SHAZAM program commands that you
would like the program to execute when you are ready to run the program.
This editor works analogously to most simple Windows-type editors.
For example, you can highlight sections and copy them by using Cntl-c moving
the cursor and using Cntl-v. Alternately, you can move sections by
using Cntl-x and Cntl-v. Or, you can use the Cut or Copy buttons across
the top (they are enabled after you highlight a section of code with the
mouse).
-
When you are ready to save the file you have been creating, click on File
and choose Save As.... Depending upon whether you want to save your
work to the C:\ drive or to a diskette in the A: drive, you can use the
"Up one level" button next to the Save in: field to find the right location.
The default name of the file will be Editor.sha. It is strongly recommended
that you change this filename. Use something like "cons.sha" if you
are saving a SHAZAM program that goes with a dataset called "cons.dat".
-
After saving the file, exit from the Editor window and verify that you
have indeed stored the file in the place you expect. Use File/Open
and choose "cons.sha" if that is how you saved the file. The folder
should still be set to the one where you saved the last file. To
restore the configuration of the windows, select Window/Tile horizontally
once again.
Editing with TED (relevant only if you plan to use this editing program)
-
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)
-
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.
-
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.
-
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
-
Now you can execute your saved SHAZAM program by first opening the file,
as you will have done at the end of the editing example. If you do
not have a file activated, use File/Open and enter the drive, folder, and
filename of the file containing the commands you want to run.
-
Verify that the code displayed in the program window (in the file a:cons.sha
or c:\cons.sha) is correct, then click on the "Run" button. In a moment,
the output of this "batch" run will appear in the SHAZAM window.
-
Caution: SHAZAM appends additional commands to whatever list of commands
you have already run. In particular, if you attempt to run the same
set of commands a second time, you may find that the "pointer" in your
data file is sitting at the end of the data file and that no additional
data is found on the second run through the program. This can be
overcome by using a "/ rewind" option on the end of the "read" command,
but it is better simply to exit SHAZAM. You need to exit SHAZAM to
terminate one particular program. Re-enter SHAZAM if you want to
run a particular program again.
-
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 the editor 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).
-
You can run your program so that it send output to the SHAZAM window.
In that case, to get a copy of the output, you would activate the output
window, edit out anything that is unneeded (if necessary, to save paper).
You might be tempted to choose File/Print to have the output sent to the
Text Only Dot Matrix printer (in the lab) or to your own printer
(if you have obtained your own copy of SHAZAM) and are working elsewhere.
However, note that the lab dot matrix printer option invoked via the SHAZAM
window does not seem to allow you to change the margins on the output so
that the annoying "wraparound" problem in some types of output is avoided.
Thus, we recommend making whatever edits you would like to make to your
output, then choosing File/Save As... and saving your output to a separate
file that can then be opened by Notepad. Notepad allows the margins
of the printed document to be changed to 0.5" and 0.5" for the left and
right, which will prevent wraparound. If any of the editing programs
appends an unnecessary .txt file extension to the name you have specified,
remember that it can be eliminated by right-clicking on the filename and
altering it to whatever you prefer.
-
If you wanted to keep a copy of the output on diskette, you would activate
the correct window and use File/Save As... Be sure to change the
filename to something informative like "cons.out" on the desired drive.
-
If you wish to make a copy of a network (n: drive) data or program file
to take to another location, you should choose File/Open and switch to
the n: drive, being sure that you are displaying All files (*.*) as necessary.
The you can save the file to a duplicate file with the same name on your
a: diskette.
-
Note: For very large problems, SHAZAM may cease execution and inform the
user how much PAR is necessary to execute the task in question. If this
happens, seek advice for how to run the program with a higher PAR value.
Exercises during introductory courses should not be constrained by the
PAR limitations of the networked version.
-
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
-
If you use an ordinary 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.
-
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.
-
Use the editor 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 the editor, 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.
-
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 the editor and continue to modify 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
-
From the main collection of icons, double-click on the Netscape icon.
-
Find the URL of the page you want to download.
-
Some of the data or program fragments for the course were created last
year. The files still contain old instructions for copying and modifying
the files so that they could be used by SHAZAM for DOS. Much of this
can now be ignored.
-
Now that we have converted to SHAZAM for Windows, the easiest way to make
copies of program fragments or data is to highlight exactly the sections
you need, and then to use the Edit/Copy/Paste sequence to copy the relevant
lines to Notepad or the SHAZAM editor screen.
-
After these fragments or data have been brought into the SHAZAM editor,
they can readily be saved on whatever drive you wish to use, under whatever
filename you like..
NOTE: These instructions are our first attempt at explaining how to run
SHAZAM for Windows in the 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
-
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. [Note--it may now be
3 diskettes....]
-
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
Windows version of SHAZAM, not the DOS version.
-
If you have older equipment, may be able to get SHAZAM to run, but it may
require a little extra effort, and you might need to resort to the DOS
version.
-
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. The course materials evolve during
the quarter.
Updated: 5:07 PM 9/1/98; Trudy
Ann Cameron ; Site
Index