The SAS Registry |
Primary Concerns about Managing the SAS Registry |
Whenever possible, use the administrative tools, such as the New Library window, the PRTDEF procedure, Universal Print windows, and the Explorer Options window, to make configuration changes, rather than editing the registry. This is to ensure that values are stored properly in the registry when changing the configuration.
Incorrect entries can cause errors, and can even prevent you from starting a SAS session.
Backing Up the SASUSER Registry |
The SASUSER(footnote 1) part of the registry contains personal settings. It is a good idea to back up the SASUSER part of the registry if you have made substantial customizations to your SAS session. Substantial customizations include the following:
installing new printers
modifying printer settings from the default printer settings that your system administrator provides for you
changing localization settings
altering translation tables with TRANTAB
When SAS starts up, it automatically scans the registry file. SAS restores the registry to its original settings under two conditions:
If SAS detects that the registry is corrupt, then SAS rebuilds the file.
If you delete the registry file called regstry.sas7bitm, which is located in the SASUSER library, then SAS will restore the SASUSER registry to its default settings.
There are two methods for backing up the registry and each achieves different results:
The result is an exact copy of the registry at the moment you copied it. If you need to use that copy of the registry to restore a broken copy of the registry, then any changes to the registry after the copy date are lost. However, it is probably better to have this backup file than to revert to the original default registry.
The result is a concatenated copy of the registry, which can be restored from the backup file. When you create the backup file using the EXPORT= statement in PROC REGISTRY, or by using the Export Registry File utility in the Registry Editor, SAS saves any portions of the registry that have been changed. When SAS restores this backup file to the registry, the backup file is concatenated with the current registry in the following way:
Any completely new keys, subkeys, or values that were added to the SASUSER registry after the backup date are retained in the new registry.
Any existing keys, subkeys, or values that were changed after SAS was initially installed, then changed again after the backup, are overwritten and revert to the backup file values after the restore.
Any existing keys, subkeys, or values that retain the original default values, will have the default values after the restore.
To use the Explorer to back up the SAS Registry:
Start SAS Explorer with the EXPLORER command, or select View Explorer.
Select Tools Options Explorer The Explorer Options window appears.
Select the Members tab.
Select ITEMSTOR in the Type list.
Click Unhide.
If ITEMSTOR does not have an icon associated with it in the Type list, you will be prompted to select an icon.
Open the Sasuser library in the Explorer window.
Right-click the Regstry.Itemstor file.
Select Copy from the pop-up menu and copy the Regstry file. SAS will name the file Regstry_copy.
Note: You can also use a copy command from your operating environment to make a copy of your registry file for backup purposes. When viewed from outside SAS Explorer, the filename is regstry.sas7bitm. Under z/OS, you cannot use the environment copy command to copy your registry file unless your SASUSER library is assigned to an HFS directory.
Using the Registry Editor to back up the SAS registry is generally the preferred backup method, because it retains any new keys or values in case you must restore the registry from the backup.
To use the Registry Editor to back up the SAS Registry:
Select the top-level key in the left pane of the registry window.
From the Registry Editor, select File Export Registry FileA Save As window appears.
Type a name for your registry backup file in the filename field. (SAS will apply the proper file extension name for your operating system.)
Click Save.
This saves the registry backup file in SASUSER. You can control the location of your registry backup file by specifying a different location in the Save As window.
Recovering from Registry Failure |
This section gives instructions for restoring the registry with a backup file, and shows you how to repair a corrupt registry file.
To install the registry backup file that was created using SAS Explorer or an operating system copy command:
Change the name of your corrupt registry file to something else.
Rename your backup file to regstry.sas7bitm, which is the name of your registry file.
Copy your renamed registry file to the SASUSER location where your previous registry file was located.
Restart your SAS session.
To restore a registry backup file created with the Registry Editor:
Select File Import Registry File.
Select the registry file that you previously exported.
Click Open.
Restart SAS.
To restore a registry backup file created with PROC REGISTRY:
Open the Program editor and submit the following program to import the registry file that you created previously.
proc registry import=<registry file specification>; run;
This imports the registry file to the SASUSER library.
If the file is not already properly named, then use Explorer to rename the registry file to regstry.sas7bitm:
Restart SAS.
To attempt to repair a damaged registry:
Rename the damaged registry file to something other than "registry"; for example, temp.
Start your SAS session.
Define a library pointing to the location of the temp registry.
libname here '.'
Run the REGISTRY procedure and redefine the SASUSER registry:
proc registry setsasuser="here.temp"; run;
Start the Registry Editor with the regedit command. Select Solutions Accessories Registry Editor View All.
Edit any damaged fields under the HKEY_USER_ROOT key.
Close your SAS session and rename the modified registry back to the original name.
Open a new SAS session to see whether the changes fixed the problem.
Using the SAS Registry to Control Color |
The SAS registry contains the RGB values for color names that are common to most Web browsers. These colors can be used for ODS and GRAPH output. The RGB value is a triplet (Red, Green, Blue), and each component has a range of 00 to FF (0 to 255).
The registry values for color are located in the COLORNAMES\HTML subkey.
You can create your own new color values by adding them to the registry in the COLORNAMES\HTML subkey:
Open the SAS Registry Editor using the REGEDIT command.
Select the COLORNAMES\HTML subkey.
Select Edit New Binary Value. A pop-up menu appears.
Enter the color name in the Value Name field and the RGB value in the Value Data field.
Click OK.
You can create your own new color values by adding them to the registry in the COLORNAMES\HTML subkey, using SAS code.
The easiest way is to first write the color values to a file in the layout that the REGISTRY procedure expects. Then you import the file by using the REGISTRY procedure. In this example, Spanish color names are added to the registry.
filename mycolors temp; data _null_; file "mycolors"; put "[colornames\html]"; put ' "rojo"=hex:ff,00,00'; put ' "verde"=hex:00,ff,00'; put ' "azul"=hex:00,00,ff'; put ' "blanco"=hex:ff,ff,ff'; put ' "negro"=hex:00,00,00'; put ' "anaranjado"=hex:ff,a5,00'; run; proc registry import="mycolornames"; run;
After you add these colors to the registry, you can use these color names anywhere that you use the color names supplied by SAS. For example, you could use the color name in the GOPTIONS statement as shown in the following code:
goptions cback=anaranjado; proc gtestit; run;
Using the Registry Editor |
The best way to view the contents of the registry is using the Registry Editor. The Registry Editor is a graphical alternative to PROC REGISTRY, an experienced SAS user might use the Registry Editor to do the following:
View the contents of the registry, which shows keys and values stored in keys.
Add, modify, and delete keys and values stored in the registry.
Import registry files into the registry, starting at any key.
Export the contents of the registry to a file, starting at any key.
Uninstall a registry file.
Compare a registry file to the SAS registry.
To run the Registry Editor, issue the regedit command on a SAS command line. You can also open the registry window by selecting Solutions Accessories Registry Editor.
In the Registry Editor window, double-click a folder icon that contains a registry key. This displays the contents of that key.
Another way to find things is to use the Find utility.
From the Registry Editor, select Edit Find.
Type all or part of the text string that you want to find, and click Options to specify whether you want to find a key name, a value name, or data.
Click
.The Registry Editor Find Utility
In the left pane of the Registry Editor window, click the key that you want to change. The values contained in the key appear in the right pane.
Double-click the value. The Registry Editor displays several types of windows, depending on the type of value you are changing.
Example Window for Changing a Value in the SAS Registry
In the SAS Registry Editor, right-click the key that you want to add the value to.
From the pop-up menu, select the New menu item with the type that you want to create.
Enter the values for the new key or value in the window that is displayed.
Registry Editor with Pop-up Menu for Adding New Keys and Values
From the SAS Registry Editor:
Right-click the item that you want to delete.
Select Delete from the pop-up menu and confirm the deletion.
From the SAS Registry Editor:
Right-click the item you want to rename.
Select Rename from the context menu and enter the new name.
After you open the Registry Editor, you can change your view from the default, which shows the registry contents without regard to the storage location. The other registry view displays both SASUSER and SASHELP items in separate trees in the Registry Editor's left pane.
Select TOOLS Options Registry EditorThis opens the Select Registry View group box.
Select View All to display the SASUSER and SASHELP items separately in the Registry Editor's left pane.
The SASHELP portion of the registry will be listed under the HKEY_SYSTEM_ROOT folder in the left pane.
The SASUSER portion of the registry will be listed under the HKEY_USER_ROOT folder in the left pane.
The Registry Editor in View Overlay Mode
You usually import a registry file, or SASXREG file when you are restoring a backup registry file. A registry file can contain a complete registry or just part of a registry.
To import a registry file using the SAS Registry Editor:
Select File Import Registry File.
In the Open window, select the SASXREG file to import.
Note: In order to first create the backup registry file, you can use the REGISTRY Procedure or the Export Registry File menu choice in the Registry Editor.
You usually export a registry file or SASXREG file, when you are preparing a backup registry file. You can export a complete registry or just part of a registry.
To export a registry file using the SAS Registry Editor:
In the left hand pane of the Registry Editor, select the key you want to export to a SASXREG file. To export the entire registry, select the top key.
Select File Export Registry File.
In the Save As window, give the export file a name.
Click
.FOOTNOTE 1: The SASHELP part of the registry contains settings that are common to all users at your site. SASHELP is write protected, and can be updated only by a system administrator.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.