Though the SAS System is a powerful tool for organizing, managing, and analyzing data, the conventional approach to using SAS limits your ability to interact directly with your data. Similarly, the command language for SAS/GRAPH is a powerful tool for visual output but is too complex and produces only static plots. SAS/INSIGHT changes all this.
SAS/INSIGHT allows you to analyze your data interactively. In SAS/INSIGHT, you can examine your data in a spreadsheet style grid, create and view plots, and fit many types of models. All this is done visually, using your mouse, rather than through writing traditional SAS programs. For a list of the capabilities of SAS/INSIGHT, see the SAS/INSIGHT document Summary of Features in the SAS/INSIGHT Online Documentation.
The SAS/INSIGHT portion of the SAS Online Documentation provides complete documentation and is a highly recommended reference if you decide to use SAS/INSIGHT on a regular basis.
To invoke SAS/INSIGHT, choose Interactive Data Analysis from the Analysis heading of the Solutions menu. Note that since SAS/INSIGHT is an interactive procedure, it can only be used in a windowing environment (e.g., Windows, X Windows, etc). This will bring up a window from where you choose which dataset you’d like to use in SAS/INSIGHT. Look through the library and data set options, and after highlighting the one you want, click on Open. This will bring up a table view of your data set. If you’d like to make a new data set, click on New instead, which will bring up a blank table.
You can also invoke SAS/INSIGHT by typing insight in the command line or by executing the statements
The latter is not recommended, though, since you cannot use any other part of SAS until exiting SAS/INSIGHT.
Using the Data Table
- The upper-left corner shows the number of variables on top-right and the number of observations in the bottom-left.
- By clicking and holding down the mouse button on the small triangle in the upper-left corner, you can open a pop-up menu that lets you find, sort, and rearrange your observations; add variables or observations; set variable characteristics; and set other options for the display of the data set. Have a look through the options on this menu; the headings are pretty self-explanatory.
- Double-clicking on an observation number listed down the left side gives you a quick view of all the values for the observation.
- Clicking on the black square next to each observation allows you to specify if you want that observation included in calculations and graphs and labeled in plots. If you have specified any color for an observation, this square will be colored instead of black.
- Double clicking on one of the variable names listed across the top is a quick way to define that variable.
- Clicking the left box above a variable names allows you to specify if a variable is to be used for grouping or labeling observations in your plots.
- The right box above a variable name tells you if that variable is numeric ( Int) or character ( Nom).
You can open multiple data tables, by selecting Open under the File menu on the main SAS window. To save changes to a data set that you have made in SAS/INSIGHT, select Save, also under the File menu. If you do this, you may notice a new variable called _obstat_. SAS uses this to store information about each observation specific to SAS/INSIGHT, such as observation color (we’ll see how to set this shortly). If you do not save your data within SAS/INSIGHT, information contained in this variable will not be retained.
Graphics Via the Analyze Menu
- A group variable is like a by variable in a SAS statement; specifying a group variable produces a graphic for each value of the group variable.
- Once you have made a graphic, right-clicking anywhere on this graphic will bring up a menu where you can specify options specific to that graphic, such as adding grid lines or specifying values of observations. Another way to access this menu is by clicking on the triangle that appears in the lower-left corner of the graphic.
Options for Graphics Via the Edit Menu
Once you have produced a graphic, you can use the following options in the Edit menu of the main SAS window to alter your graphic.
allows you to alter the input you specified for a graphic.
- Copy Window
prints another copy of a graphic to the screen.
makes the axes the same for graphics in the same window.
allows you to put animation into your graphics.
converts a graphic to a static image. Normally, when you alter your data in any way, all previously made graphics change accordingly. This option prevents this. Among other things, this allows you to make graphics with different observations without having to use separate data sets.
- Select All
selects everything in a graphics or data table window.
brings up the Tools window. This window has several uses: Coloring observations on a graphic using the colored buttons. Marking observations on a graphic using the shape buttons. Changing the look of a line or curve using the line buttons. Changing the size of a graphic using the magnifying glass button. Changing the length of axes using the hand button. Changing the width of bars on a histogram using the hand button.
allows you to change the font of text in your graphics.
- Display Options, Windows Options, and Graphics Options
allow you to change display, windows, and graphics preferences, respectively.
Allows you to perform various transformations on variables.
- Find and Examine
allows you to select certain observations and then view their values.
- Label in Plots, Unlabel in Plots, Show in Graphics, Hide in Graphics, Include in Calculations, Exclude in Calculations
allows you to specify which observations are/are not labeled in graphs, included in graphs, and included in calculations, respectively. Note that for single observations, you can also do this in the data table, as described earlier.
- Invert Selection
unselects observations selected in the Find option, and selects all previously unselected observations.
Allows you to change the formats on variables.
Copy and Delete
Copies a graphic to the clipboard or deletes a graphic. Note that delete does not close a graphics window, it just deletes one of the graphics if there are more than one in a window (e.g., if you did a graph using a group variable).
Statistics Via the Analyze Menu
The choices Distribution, Fit, and Multivariate from the Analyze menu on the main SAS window allow you to examine a variable’s distribution, perform regressions of one variable on others, and perform correlation analysis, respectively. Many powerful statistical procedures can be found within these menus.
The initial window that comes up after selecting each of these is similar to all the other chart and plot windows we’ve seen previously. One particularly useful option: selecting the Output button in this window allows you specify what plots and charts to produce initially.
You can produce more plots and charts and output particular regression variables by selecting items from the Graphs, Curves, and Vars menus that now appear on the main SAS window. Discussion of the choices in these menus for each of the three options is beyond the scope of this document; I think you’ll find that by just clicking around in each of the menus, you’ll quickly get the basic idea and will easily be able to figure out how to do the statistical analysis you desire.
Printing and Saving
To print a graphic or chart in Windows, just go to Print in the File menu. You can do the same thing in X Windows, but this prints your graphic or chart to a file, which you can then print. See Printing from Research Computing servers for more information on this. To print only portions of a SAS window (e.g., a scatterplot produced in a regression), select that portion by drawing a box around it with your mouse. Then go to Print in the File menu as before.
To save a graphic, go to Save in the File menu. You can choose either Graphics Catalog, which saves to a SAS/GRAPH catalog, or Graphics File, which saves to a BMP, GIF, PBM, Postscript, or MFF graphics file. To save a chart, choose Tables. This prints the tables to the output window, which you can then save in an output file as you normally would. Additionally, output from SAS/INSIGHT is controlled via the Output Delivery System like any other output, so you can use these statements in the editor window as well.