BookmarkSubscribeRSS Feed
FK1
Lapis Lazuli | Level 10 FK1
Lapis Lazuli | Level 10

Hello Everyone,

programmatically, I am trying to create an overview as of which dataset(s) is/are the basis for a given IMAP, and in turn, which IMAP(s) is/are the basis for a given Web Report Studio Report (*.srx).

 

So far, I only found this:
https://communities.sas.com/t5/SAS-Web-Report-Studio/list-all-srx-reports-in-a-sas-9-4-ebi-install/m...

But I cannot really work with the xml, do I ?

 

Does anyone have a sample code using the "metadata_" functions of SAS Base?


2 REPLIES 2
andreas_lds
Jade | Level 19

Have you tried reading the xml file with a libname statement? If this won't work, you could use metadata_getnobj together with other metadata-function in a data step. Unfortunately i don't have any code processing the reports.

FK1
Lapis Lazuli | Level 10 FK1
Lapis Lazuli | Level 10

Hi @andreas_lds ,

I seem to have the wrong xml-object, since I do not get any results returned. This is, what I have, so far:

 

/* Liste der verfügbaren Reports */
data work._md_reports (keep=report_id report_name report_metadatenpfad report_type);

FORMAT report_id report_name report_metadatenpfad report_type	 ;

	length 
        type id report_uri turi_id parenttree_id $50. 
        report_name folder pfolder path report_metadatenpfad  report_type $255. 
        report_id $17.
    ;

	call missing(of _character_);


    report_obj="omsobj:SASReport?[@PublicType='Report']";     /* "*[@PublicType='Report']" */
	report_count=metadata_resolve(report_obj,type,id);

	if report_count ge 1 then do i=1 to report_count;
		rc=metadata_getnobj(report_obj,i,report_uri);
		rc=metadata_getattr(report_uri,"Name",report_name);
		rc=metadata_getattr(report_uri,"Id",report_id);
        rc=metadata_getattr(report_uri,"PublicType",report_type);

        rc=metadata_getnasn(report_uri,"Trees",1,turi_id);
        rc=metadata_getattr(turi_id,"Name",folder);

        path=folder;

    	parent_rc=metadata_getnasn(turi_id,"ParentTree",1,parenttree_id); /* Determine if the metadata folder is top-level */

    	if parent_rc > 0 then do while (parent_rc > 0); /* If not, this loop assembles the metadata path, as these are nested "Tree" objects. */
    		rc=metadata_getattr(parenttree_id,"Name",pfolder);
    		path=cats(pfolder,"\",path);
    		parent_rc=metadata_getnasn(parenttree_id,"ParentTree",1,parenttree_id);
    	end;


        report_metadatenpfad=cats("\", path);

		output;
	end;

label 
        report_name           = "Name des Reports."
        report_id             = "URI des Reports."
        report_metadatenpfad  = "Speicherort im Metadatenbaum."
        report_type           = "Ausprägung der Eigenschaft 'Type' des Report-Objektes."


;

run;

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 829 views
  • 0 likes
  • 2 in conversation