Examples: REGISTRY Procedure


Example 1: Importing a File to the Registry

Procedure features: IMPORT=

Other features: FILENAME statement

This example imports a file into the SASUSER portion of the SAS registry.

Source File

The following file contains examples of valid key name sequences in a registry file:

 [HKEY_USER_ROOT\AllGoodPeopleComeToTheAidOfTheirCountry]   @="This is a string value"    "Value2"=""    "Value3"="C:\This\Is\Another\String\Value" 

Program

Assign a fileref to a file that contains valid text for the registry. The FILENAME statement assigns the fileref SOURCE to the external file that contains the text to read into the registry.

 filename source '  external-file  '; 

Invoke PROC REGISTRY to import the file that contains input for the registry. PROC REGISTRY reads the input file that is identified by the fileref SOURCE. IMPORT= writes to the SASUSER portion of the SAS registry by default.

 proc registry   import=source;  run; 

SAS Log

 1   filename source '  external-file  ';  2   proc registry  3      import=source;  4   run;  Parsing REG file and loading the registry please wait   .  Registry IMPORT is now complete. 

Example 2: Listing and Exporting the Registry

Procedure features:

  • EXPORT=

    LISTUSER

This example lists the SASUSER portion of the SAS registry and exports it to an external file.

Note: This is usually a very large file. To export a portion of the registry, use the STARTAT= option.

Program

Write the contents of the SASUSER portion of the registry to the SAS log. The LISTUSER option causes PROC REGISTRY to write the entire SASUSER portion of the registry to the log.

 proc registry     listuser 

Export the registry to the specified file. The EXPORT= option writes a copy of the SASUSER portion of the SAS registry to the external file.

 export='  external-file  ';  run; 

SAS Log

 1  proc registry listuser export='  external-file  ';  2  run;  Starting to write out the registry file, please wait   The export to file  external-file  is now complete.  Contents of SASUSER REGISTRY.  [  HKEY_USER_ROOT]  [    CORE]  [      EXPLORER]  [        CONFIGURATION]          Initialized= "True"  [        FOLDERS]  [          UNXHOST1]            Closed= "658"            Icon= "658"            Name= "Home Directory"            Open= "658"            Path= "~" 

Example 3: Comparing the Registry to an External File

Procedure features: COMPARETO = option

Other features: FILENAME statement

This example compares the SASUSER portion of the SAS registry to an external file. Comparisons such as this are useful if you want to know the difference between a backup file that was saved with a .txt file extension and the current registry file.

Note: To compare the SASHELP portion of the registry with an external file, specify the USESASHELP option.

Program

Assign a fileref to the external file that contains the text to compare to the registry. The FILENAME statement assigns the fileref TESTREG to the external file.

 filename testreg '  external-file  '; 

Compare the specified file to the SASUSER portion of the SAS registry. The COMPARETO option compares the contents of a file to a registry. It returns information about keys and values that it finds in the file that are not in the registry.

 proc registry     compareto=testreg;  run; 

SAS Log

This SAS log shows two differences between the SASUSER portion of the registry and the specified external file. In the registry, the value of Initialized is True ; in the external file, it is False . In the registry, the value of Icon is 658 ; in the external file it is 343 .

 1   filename testreg '  external-file  ';  2   proc registry  3     compareto=testreg;  4  run;  Parsing REG file and comparing the registry please wait   .  COMPARE DIFF: Value "Initialized" in  [HKEY_USER_ROOT\CORE\EXPLORER\CONFIGURATION]: REGISTRY TYPE=STRING, CURRENT  VALUE="True"  COMPARE DIFF: Value "Initialized" in  [HKEY_USER_ROOT\CORE\EXPLORER\CONFIGURATION]: FILE TYPE=STRING, FILE  VALUE="False"  COMPARE DIFF: Value "Icon" in  [HKEY_USER_ROOT\CORE\EXPLORER\FOLDERS\UNXHOST1]: REGISTRY TYPE=STRING,  CURRENT VALUE="658"  COMPARE DIFF: Value "Icon" in  [HKEY_USER_ROOT\CORE\EXPLORER\FOLDERS\UNXHOST1]: FILE TYPE=STRING, FILE  VALUE="343"  Registry COMPARE is now complete.  COMPARE: There were differences between the registry and the file. 

Example 4: Comparing Registry Files

Procedure features

  • COMPAREREG1= and COMPAREREG2= options

    STARTAT= option

This example uses the REGISTRY procedure options COMPAREREG1= and COMPAREREG2= to specify two registry files for comparison.

Program

Declare the PROCLIB library. The PROCLIB library contains a registry file.

 libname proclib '  SAS-data-library  '; 

Start PROC REGISTRY and specify the first registry file to be used in the comparison.

 proc registry comparereg1='sasuser.regstry' 

Limit the comparison to the registry keys including and following the specified registry key. The STARTAT= option limits the scope of the comparison to the EXPLORER subkey under the CORE key. By default the comparison includes the entire contents of both registries.

 startat='CORE\EXPLORER' 

Specify the second registry file to be used in the comparison.

 comparereg2='proclib.regstry';  run; 

SAS Log

 8    proc registry comparereg1='sasuser.regstry'  9  10      startat='CORE\EXPLORER'  11      comparereg2='proclib.regstry';  12   run;  NOTE: Comparing registry SASUSER.REGSTRY to registry PROCLIB.REGSTRY  NOTE: Diff in Key (CORE\EXPLORER\MENUS\FILES\SAS) Item (1;&Open)  SASUSER.REGSTRY Type: String len  17 data PGM;INCLUDE '%s';  PROCLIB.REGSTRY Type: String len  15 data WHOSTEDIT '%s';  NOTE: Diff in Key (CORE\EXPLORER\MENUS\FILES\SAS) Item (3;&Submit)  SASUSER.REGSTRY Type: String len  23 data PGM;INCLUDE '%s';SUBMIT  PROCLIB.REGSTRY Type: String len  21 data WHOSTEDIT '%s';SUBMIT  NOTE: Diff in Key (CORE\EXPLORER\MENUS\FILES\SAS) Item (4;&Remote Submit)  SASUSER.REGSTRY Type: String len  35 data SIGNCHECK;PGM;INCLUDE '%s';RSUBMIT;  PROCLIB.REGSTRY Type: String len  33 data SIGNCHECK;WHOSTEDIT '%s';RSUBMIT;  NOTE: Diff in Key (CORE\EXPLORER\MENUS\FILES\SAS) Item (@)  SASUSER.REGSTRY Type: String len  17 data PGM;INCLUDE '%s';  PROCLIB.REGSTRY Type: String len  15 data WHOSTEDIT '%s';  NOTE: Item (2;Open with &Program Editor) in key        (CORE\EXPLORER\MENUS\FILES\TXT) not found in registry PROCLIB.REGSTRY  NOTE: Diff in Key (CORE\EXPLORER\MENUS\FILES\TXT) Item (4;&Submit)  SASUSER.REGSTRY Type: String len  24 data PGM;INCLUDE '%s';SUBMIT;  PROCLIB.REGSTRY Type: String len  22 data WHOSTEDIT '%s';SUBMIT;  NOTE: Diff in Key (CORE\EXPLORER\MENUS\FILES\TXT) Item (5;&Remote Submit)  SASUSER.REGSTRY Type: String len  35 data SIGNCHECK;PGM;INCLUDE '%s';RSUBMIT;  PROCLIB.REGSTRY Type: String len  33 data SIGNCHECK;WHOSTEDIT '%s';RSUBMIT;  NOTE: PROCEDURE REGISTRY used (Total process time):        real time           0.07 seconds        cpu time            0.02 seconds 



Base SAS 9.1.3 Procedures Guide (Vol. 1)
Base SAS 9.1 Procedures Guide, Volumes 1, 2, 3 and 4
ISBN: 1590472047
EAN: 2147483647
Year: 2004
Pages: 260

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net