Creating graphs from RATS on fmrisc.bc.edu


RATS has elaborate graphing facilities, but you will not be able to see what you can get on a "dumb terminal" emulator--you need to run a desktop version of RATS on the Macintosh or PC to do that. However you can get laser-printed graphs out of mainframe RATS, and print them on the HP LaserJet printer in Carney 136. Here's an example:

env noshowgraphs (IMPORTANT-place this line at top of program)
open plot market.rgf
dec vec[string] hdr(40)
display(store=hdr(1)) 'Excess Return on Market Portfolio'
display(store=hdr(2)) 'Excess Return on Technology Portfolio'
display(store=hdr(3)) 'Excess Return on Natural Resource Portfolio'
display(store=hdr(4)) 'Excess Return on Services Portfolio'
compute j=0
spgraph(hfields=2,vfields=2)
dofor i=xm comp natr serv
compute j=j+1
graph(header=hdr(j)) 1
# i
enddo
spgraph(done)
close plot
dos "rgf2pst market.rgf market.ps"
dos "lpr market.ps"
dos "rm market.ps"
dos "rm market.rgf"

This (unnecessarily complicated) fragment of RATS code places the results of graph commands on the PLOT unit. (If you just want to graph one series with no bells nor whistles, graph 1 followed by # seriesname will do it).

The last four lines (the "DOS" commands) actually pass their arguments to the UNIX command line in order to generate a PostScript file and send it to the Carney 136 printer ("Some academic scribbler"). To access a different printer, change the "-P" argument.

Make sure you give the -P argument to lpr, and do not attempt to send the .gph file to any printer!


C F Baum Revised: 06 November 1998