SAS/Warehouse Administrator Metadata API- P56: The operating system and SAS version that are associated with a given host are now available through the WHHOST property. For example, you can write a SAS/Warehouse Administrator add-in that reads the host metadata that is associated with a given data store and then uses these values to generate code that is appropriate for the operating system and SAS version. | 272 273 Sample Metadata API Code Appendix Overview 273 Read Metadata Code Sample 273 Write Metadata Code Sample 277 Appendix Overview This appendix contains SCL code that uses the metadata API to access SAS Warehouse Administrator metadata. For longer examples see the sample metadata API applications in the catalog. That catalog includes the BLDPAGE program which reads metadata and outputs it in HTML format. Read Metadata Code Sample Sample Read Metadata Program for SAS Warehouse Administrator length primary_repos_id 8 length sec_repos_id 8 init Create an instance of the metadata API. i_api instance loadclass l_rc 0 Access the SAS Warehouse Administrator Sample repository. path SASROOT whouse dwdemo _master repos_type WHDWENV Insert the Location information into the metadata list with a name of LIBRARY. 274 Read Metadata Code Sample A Appendix 1 l_inmeta makelist l_lib makelist l_inmeta insertl l_inmeta l_lib -1 LIBRARY Use the default Libname Engine to access a Local Path. l_lib insertc l_lib -1 ENGINE l_path makelist l_lib insertl l_lib l_path -1 PATH l_opts makelist l_lib insertl l_lib l_opts -1 OPTIONS l_path insertc l_path path -1 Set the primary repository. If a bad return code is returned then we can t continue. call send i_api _SET_PRIMARY_REPOSITORY_ l_rc l_inmeta repos_type primary_repos_id l_meta l_inmeta dellist l_inmeta Y if l_rc 0 then do We were able to access the primary repository correctly. Get the list of available secondary repositories under this primary repository. l_reps makelist l_meta setniteml l_meta l_reps REPOSITORIES call send i_api _GET_METADATA_ l_rc l_meta if l_rc 0 then do num_reps listlen l_reps if num_reps 0 then do If any secondary repositories select one to set as the active one. l_sec_rep getiteml l_reps 1 call send i_api _SET_SECONDARY_REPOSITORY_ l_rc l_sec_rep sec_repos_id If l_rc 0 then sec_repos_id contains the 8 character repository id of this repository. This id is used as .