Section 1.5: Customizing the System Set-Up for the PC Once you have loaded SAS onto your PC, you may want to modify a few system options to set SAS to work according to your personal preferences. 1. MAXIMIZE THE SIZE OF THE EDITOR WINDOW WITHIN THE SAS DISPLAY MANAGER 2. MOVE THE "CLEAR ALL" ICON AWAY FROM THE "RUN" ICON 3. SUBMIT STATEMENTS AUTOMATICALLY WHEN YOU START SAS 4. MODIFYING THE SAS CURRENT FOLDER 5. TURN ON THE AUTOSAVE 6. SCREEN DISPLAY CUSTOMIZATION AND ACCESSIBILITY 7. EDIT & MANAGE THE SAS CONFIGURATION FILE 8. CHANGE FOLDER WHERE SAS STORES TEMPORARY FILES The first six tasks are of particular importance for all users to review and make the necessary modifications. 1. Maximize the size of the Editor window within the SAS Display manager Adjust the editor window to the size you want it, go to the command bar, and type "wsave" and press return. That will save this window size to your SASUSER.PROFILE catalog. 2. MOVE THE "CLEAR ALL" ICON AWAY FROM THE "RUN" ICON A potential problem exists with the placement of two icons for the enhanced text editor window in the default layout. The running figure for "submit" icon and the "clear all" icon appear side-by-side. This placement can cause problems when you intend to submit the contents of a command file and accidentally press the "Clear" button instead. When this unintended action occurs, you can retrieve the contents of the file with the "Undo" button, but will need to save the file once more with "Save As" to give the contents the correct file name (be sure not to over-write a different file!). You can avoid this potential problematic situation by moving the "clear" button away from "submit". That is, you can rearrange the order of the icons as they appear on the toolbar. To do this, go to the pull-down menu: Tools -> Customize -> Customize At the lower portion of this screen you will see all the icons with a short description of their function in the order they currently exist on the toolbar. Near the bottom of the list you will see "Clear All". Highlight it and then find the up-down arrows in the middle of the window. Press the "down arrow" until the "Clear All" button moves to the bottom. Then press "OK" to finish the process whichi will move the "Clear" icon away from "Submit". You will now see the "Clear All" icon at the far right-hand side of the tool bar. 3. SUBMIT STATEMENTS AUTOMATICALLY WHEN YOU INVOKE SAS To submit SAS statements you would like to run every time you first start SAS, store them in an autoexec file. SAS will run these statements automatically after the system is initialized. Any valid SAS statement, such as OPTIONS, TITLE, even DATA and PROC steps, can be included in this file. For example, you can set report titles, footnotes, or run macros or enter contents into macro variables automatically with an autoexec file. Instead of typing them manually every time you run SAS or at the beginning of every program, you can enter them into the SAS Editor and then save them in a file called autoexec.sas placed in the same subdirectory where you found the SAS config file for your system. You may want to change the default values of specific options or invoke other SAS statements at each start-up; the following choices are standard choices that you may find helpful to always include at the very beginning of your session: OPTIONS NOcenter NOnumber formdlim='_' ls=80 ps=55 dkrOCond=NOwarning NOfmterr MergeNoBy=error yearcutoff=1915 MsgLevel=i mPrint formchar='|----|+|---'; SAS has many options available for program operation, debugging, and formatting printed output (among others). You can view a list of all the options available and their current settings by running: PROC OPTIONS; RUN; The listing of all options and their current settings will appear in the log window (not the output window). An OPTIONS statement for the settings you want should be entered before any other statements (such as those stored in the autoexec.sas file) and within individual command files when running in batch mode. For any option you want as a default, "Set it, and forget it, in your autoexec." - Ron Fehd You can read what these options do in Chapters 3 or 6 (and will also be interspersed among the many sections of this resource). 4. MODIFYING THE SAS CURRENT FOLDER The "working folder", also known as the SASinitialFolder, is an important concept to know when reading and saving data sets, formats, macros or programs read from external files, or other objects written or read within the session. The location of this folder is the path name where SAS reads or stores files when a specific drive and pathname isn't given (instructions for reading and saving SAS programs will be dealt with in a later section). For example, if you do not provide a drive and pathname within the statements such as LIBNAME, FILENAME, INFILE, %INCLUDE or other statements that refer to external files or directories, SAS looks for these files in the working folder. The name of this path appears in a small window located in the lower right-hand corner of your SAS session. If you haven't changed it, in Version 9 the SASinitialFolder defaults to: C:\Documents and Settings\\My Documents\My SAS Files\9.1 And in version 8 C:\Documents and Settings\\My Documents\My SAS Files\V8 If SAS doesn't find the file in the current folder, an error message will be printed in the LOG window, and your program won't run. The drive and path name of the current or working folder is shown in the status bar at the lower right portion of your interactive SAS session. You can change it at any time with a 'left' double-click within that rectangle to access a dialogue box. Then enter the drive and path to your desired current folder in the space provided or move through the folders as you would search for a particular file. If you want SAS to determine the initial folder for any reason or to place the startup folder in a macro variable, use the following statements in Windows: LIBNAME _dummy_ "."; %PUT SAS Startup folder: %NRBQUOTE(%SYSFUNC(PATHNAME(_DUMMY_))); It will give you: SAS Startup folder: C:\consult SAS statements can be used that do not make specific references to the current folder, such as: LIBNAME dat "."; or in the DATA step as: DATA dat.mydata; INFILE "mydata.csv" DLM="," dsd firstobs=2; INPUT a b c; RUN; When you change the current folder by accessing the Change Folder dialog box, it does not make it permanent. The next time you invoke the SAS System, the current folder will default to the current folder that was permanently set. Also note that changing current folder within a SAS session does not apply to the directories used for the 'Save As' and 'Open' dialog boxes under the 'File' menu (upper left corner). They do not change to the current folder specification; rather, they default at the beginning of a SAS session to the folder associated with the SASUSER libref. To set the current folder to a new location and to change the file for reading and saving programs as well, requires that you edit the 'Properties' dialog box associated with your manner of invoking SAS. This folder needs to exist _before_ you go through the following steps. First, find the dialogue box to edit the properties window by beginning SAS from the "Start / All Programs" menu (found in the lower left corner of your screen). You will first see "SAS". The tab for "SAS 9.1 (English)" appears so click it once with the right side of your mouse. Select "Properties" from the bottom of the list of choices and then look for the box labeled 'Target'. Go to the far end of the right-hand side of what you see in that line. Be sure you do not delete or modify any characters already present in this box. You can reach the end of the line by clicking anywhere inside this box and then pressing the "End" key (next to the numeric pad on your keyboard) which will take you to the far right-hand side. At this point, press the right arrow key to unselect the highlighted text, type one space, and enter the following command exactly as you see it here: -sasInitialFolder="." The current or working SAS folder will be the pathname that is specified in the 'Start in' field (located just below the 'Target' field). To designate your choice of the current folder, enter the drive and pathname of it within that box. This folder needs to exist on the specified directory. You can also change the option to 'Maximize' or 'Minimize' the size of window SAS uses at start up. 5. TURN ON THE AUTOSAVE You can also turn on the autosave option (if it is not already "on"). To do this from your toolbar: Tools / Options / Preferences Go to the tab called "Edit". You should have the autosave option ticked. Also, set the time to the maximum amount of time you would want to retype code. 6. SCREEN DISPLAY CUSTOMIZATION AND ACCESSIBILITY When you start SAS three screens are made available for viewing: output, log, and Enhanced Editor (or Program Editor). The Enhanced and Program editors are the only windows into which you can directly write SAS programs. The Enhanced Editor makes reading, writing, and editing of SAS programs much easier. The most noticeable difference between it and the Program Editor is the use of color codes in the Enhanced Editor. This feature allows you to easily distinguish between different elements of a SAS program and check for errors as you type. These colors can be changed to match your preferences (see below). The editor applies them automatically so that programs will be read more easily as they are written. The SAS System allows you to customize the size of the fonts and icons to your liking in the various windows. Keep in mind that only monospace fonts work well with SAS, especially for the Output window. The SAS System uses the “Sasfont” font by default. Two types of windows are affected separately: How to Find the Dialogue Box Window Type to Make the Desired Changes ----------------------------------------------------------------------- Standard SAS windows (such as Program Editor, Log, and Output) Tools->Options->Fonts Enhanced Editor Tools->Options->Enhanced Editor To enlarge the font in the Standard SAS Windows, you need to first make any one of these windows “active” by clicking with the mouse inside one of them. Then go to Tools->Options->Fonts, select a monospace font in the Font field (e.g., SAS Monospace works well), and choose a font size in the Size box. A choice of 10 or 12 is probably sufficient, but you may want to make it larger or smaller depending on your comfort in viewing the size of the text you see. The obvious trade-off is that larger print is easier to read, yet not as much information can be displayed on the screen. Click OK when you have made your choice. [Note: To affect the font size and type used for output sent to the printer, you need to use the Font button in the Print Setup dialog box.] The SAS System does not automatically retain these font settings from one session to the next. To make them permanent, enter WSAVE ALL in the Command bar that appears in the upper left hand corner and press enter. To change the type and font used in the Enhanced Editor, first make it the “active” window with a click of your mouse. If you don't see this window, open a new one from the View menu. SAS includes several more options for this editor which is the reason for a separate font selection window. You’ll have two dialog boxes to choose from: General and Appearance. The ‘General’ window allows you to change general editing features. The ‘Appearance’ window allows you to modify the fonts, and also choose from various color schemes which SAS uses to display keywords, comments, data, formats, and several other options. The color scheme you choose is an invaluable aid to detect errors within your program before running them. The capability to highlight text with different colors is functional within the Enhanced Editor window. If you open a SAS program in the Windows Notepad or Workpad, you won't have the colors available. These colors can be transferred to documents if you copy them from this SAS window and paste them in a WORD file, should you want to include the color-coded features. If the Enhanced Editor is not the default editor when you open SAS and you would like it to be (highly recommended), go to the Tools->Options->Preferences and select the edit window to specify Enhanced Editor to be used at start up. To modify the size of the various SAS windows, use the mouse to first adjust the height and width of each one separately. To make these changes take effect for every new SAS session, type WSAVE in the command bar and press enter when you are finished with each window. You can make all the desired changes individually and then enter WSAVE ALL when you are finished. For syntax highlighting with the Enhanced Editor, the code should be displayed in color you saved it when you name it with a *.sas extension. If you save changes with some other extension, you have to tell SAS that it's one you want highlighted. Click “Tools->Options->Enhanced Editor” and go to the General tab. On the bottom of that tab is a File Extensions button. Click that and you can see the extensions for which the editor will highlight. For more detailed information on the Enhanced Editor, look in the SAS Online Docs at http://sas.uoregon.edu/sashtml/win/zenhcded.htm From http://sas.uoregon.edu/sashtml/main.htm you can reach this window under: SAS Companion for the Microsoft Windows Environment --> Interacting With the SAS System for Windows --> Using the Enhanced Editor 7. EDIT & MANAGE THE SAS CONFIGURATION FILE The default installations of Versions 8.2 and 9.1.3 of the SAS System place several configuration files (with the name SASV8.cfg or SASV9.cfg) on your system in SAS subdirectories. Depending on the version you have, the one usually accessed when you start SAS is located in: c:\Program Files\SAS Institute\SAS\V8 or c:\Program Files\SAS\SAS 9.1\nls\en\SASV9.CFG To find the directory from which SAS reads this file enter PROC OPTIONS; RUN; in the command window and search for config in the LOG window to determine which file SAS read. Other locations are also allowed for placement config files. You can enter 'Search' from the Start Menu to find the location of all the files with the .cfg extension. You may not be able to see the .cfg extension; it should be the only file that contains the letters SASV8 or SASV9. You can open each config file you find with the Windows text editor using a double click on the file name. Carefully type in the following line at the very top of this file which will be used to identify the pathname of the location of the config SAS used when starting: -INITSTMT "%PUT Config file used: c:\;" Enter the drive and specific pathname exactly as you observe it in the Windows box where it was opened, for example: -INITSTMT "%PUT Config file used: c:\Program Files\SAS\SAS 9.1;" Be sure to end the statement with a semi-colon and place the double quotes around the text as indicated above. When SAS is invoked, the name of the specific configuration file that SAS read will appear at the top of the SAS log. This entry allows you to refer back to the log file if you have any question about which config file was used. While you have this file open, add the following line directly below the one you just entered: -ECHOAUTO The reason for including this second command will be explained in a subsequent section for the autoexec.sas file you may want to add to this directory. Another feature you can edit is the default location for the online help documentation which you will find several lines down in the *.cfg file. The line you need to edit is actually listed below the line that says /* DO NOT EDIT BELOW THIS LINE - INSTALL Application edits below this line */ Despite the warning you may carefully make the following edit for online documentation. Find the line that begins -DOCLOC. Place the online documentation website's address following the -DOCLOC keyword between quotes as shown below. Rather than delete the existing -DOCLOC statement, place it between comment markers /* ... */ and type a new -DOCLOC statement directly below it, so it appears as follows: /* Default locations for online help */ /* -DOCLOC "file://C:\Program Files\SAS Inst ... base.hlp\docloc.htm" */ -DOCLOC "http://sas.uoregon.edu/sashtml/main.htm" SAS documentation for Version 8.2 is available on a university website as http://sas.uoregon.edu (the large blue books are also available in the documents room, MacKenzie 175). You can also select webpages for the manuals for both Version 8.2 and 8.1.3 directly from the SAS institute as described in Section 1.8. You can then place these particular web pages as a 'favorites' in your browser. When finished editing the SAS config file, save it with ‘File Exit’ and then click ‘yes’ when requested to save the changes. It is important that you do not add any stray characters within the file itself or inadvertently change the file name. The config file is always read by SAS when you start the program. If SAS doesn’t find it, SAS won’t run. If you want to see the results of what particular options settings this particular config file will select for you, start a SAS session with the command prompt by first going to the path: c:\Program Files\SAS Institute\SAS\V8 At the prompt enter: sas -verbose The verbose option writes these details to your terminal LOG window; you can watch for messages about the settings of the config file (or files) in use. 8. CHANGE FOLDER WHERE SAS STORES TEMPORARY FILES This option is rarely needed, so if you don’t have a specific reason for doing so, skip to the next section. To change the location where SAS stores and reads temporary files, enter the following command line option. For example, to move this folder from its designated path on the c: drive to your choice of c:\sas\work\~ use: "c:\Program Files\SAS Institute\SAS\V8\sas.exe" -work="c:\sas\work"