BookmarkSubscribeRSS Feed
adnavv
Fluorite | Level 6

Hello,

 

we need to identify the dependencies among 50 different catalogs in a SAS 9.4 environment (without SAS Studio, but with SAS Explorer).

 

For example, we would like to find all source code (scl, frame, screen, mainly) in our catalogs universe containing the path to the catalog named "gesco" ("/env/app/gesco").

 

It seems that the find function doesn't allow us to use this search criteria :

 

2022-08-15 12_05_30-Window.jpg

 

Is there another way to parse the catalog source code to query LIBNAME paths ?

 

Many thanks in advance,

Wanda

 

 

 

10 REPLIES 10
Patrick
Opal | Level 21

Some code like below should give you the list of all entries belonging to a specific catalog. Requires of course that there is a libname that assigns the folder with the catalog to the SAS session.

proc sql;
  create table want as
  select *
  from dictionary.catalogs
  where memname='GESCO' and memtype='CATALOG'
  ;
quit;
adnavv
Fluorite | Level 6

Thank you Patrick, but with this query, I can only get internal references to the catalog 'GESCO', although I know, for example, that in the init.scl file of another catalog (named 'GESBA'), there is the following reference : libname gesco "/env/data/gesco": how can I retrieve it ? Do the dictionary tables contain such information ?

Tom
Super User Tom
Super User

@adnavv wrote:

Thank you Patrick, but with this query, I can only get internal references to the catalog 'GESCO', although I know, for example, that in the init.scl file of another catalog (named 'GESBA'), there is the following reference : libname gesco "/env/data/gesco": how can I retrieve it ? Do the dictionary tables contain such information ?


See if you can do it with a data step.

filename src catalog 'mylib.gesba.init.scl';
data _null_;
  infile src;
  input;
  if find(_infile_,'gesco','i') then list;
run;
ballardw
Super User

@adnavv wrote:

Thank you Patrick, but with this query, I can only get internal references to the catalog 'GESCO', although I know, for example, that in the init.scl file of another catalog (named 'GESBA'), there is the following reference : libname gesco "/env/data/gesco": how can I retrieve it ? Do the dictionary tables contain such information ?


Dictionary tables would only have the library if the library is active in the current session

 

 

 

 

Patrick
Opal | Level 21

@adnavv wrote:

Thank you Patrick, but with this query, I can only get internal references to the catalog 'GESCO', although I know, for example, that in the init.scl file of another catalog (named 'GESBA'), there is the following reference : libname gesco "/env/data/gesco": how can I retrieve it ? Do the dictionary tables contain such information ?


SAS catalogues are stored in SAS proprietary binary files with extension .sas7bcat 

  • If you just want to search for all SAS catalog files then use a Unix find command like find / -type f -name "*.sas7bcat" 2>/dev/null
  • If you want to find code that assigns libnames to folders containing "*.sas7bcat" files then combine the find command with a grep to find all scripts with a path to a folder that contains a SAS catalog file. This will only give you a partial result though as there can also be pre-assigned libraries in SAS Metadata that contain catalogs.
  • If you want to know what's IN the catalogues then generate libnames for all the folders where you find a *.sas7bcat file and then you can use the SAS dictionary tables and Proc Catalog for further investigation.

 

SASKiwi
PROC Star

SAS Note 23187 describes how you can print SOURCE and SCL catalog entries to external text files using PROC BUILD. You can then search the text files using SAS or other text search tools (Notepad++ is a good option). I assume that you would need SAS/AF installed and licensed to do this.

SASKiwi
PROC Star

@Patrick  - The CATALOG Access Method doesn't appear to work for SCL entries.

adnavv
Fluorite | Level 6

Thank you for sharing!

 

I have done a quick test with appending two catalogs source codes ('gesco', 'gesba'). The procedure has exported a total of 150 pages, which I still need to validate, but it may help me a lot. 

 

2022-08-16 12_36_49-Window.jpg

 

 

 

 

adnavv
Fluorite | Level 6

We would need to extract the source code of each screen belonging to each catalog (*.sas7bcat). It seems that the PROC BUILD doesn't allow to export the screen source code..

 

Is there a another way to get it ?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 922 views
  • 2 likes
  • 5 in conversation