As a SAS administrator, you may face situations where you need to locate content that has been modified in the system since a given point in time. If the system has many content developers, discovering all of the folders, libraries, tables, reports, explorations, and similar items that have been modified can be a daunting task. Fortunately, the ExportPackage command from the SAS Platform Object Framework provides just what we need for tackling this sort of question.
Having a command line utility that combs metadata for objects modified or created based on a date criteria can be helpful in many situations. For example:
- The administrator oversees a system where full backups are not scheduled to run every day. However, to minimize lost work in the event of a system failure, the administrator would like to create a package of all content that was modified each day so that it could be restored if necessary.
- A content developer contacts the administrator saying that she would like to create a package of everything she has modified since yesterday but cannot recall everything that she has done.
- It is Thursday and a problem has arisen that requires reverting the system to its state as of Sunday night which was the last backup. Before reverting the system from the backup, the administrator would like to create a package of any content modified since Monday morning so that it can be restored after the reversion.
The ExportPackage utility can help in all of these situations. To see how, I am going to run the command on my system to locate all of the content I have created today in the /Enterprise folder tree, which is where I store content for testing.
As you can see, the ExportPackage command takes several arguments that allow me to control the scope of metadata that is searched for content and to filter that content on a date specification. The key arguments in my command are:
- -profile “SASAdmin” – I am using the SASAdmin metadata connection profile to identify my metadata server and to provide a user and password rather than specifying each value individually on the command line.
- -since “Today” – This is the magic. I just want today’s changes so the keyword “Today” is perfect. It also makes scripting this command much easier as I do not have to know the current date. Of course, if I needed to specify an exact date I can certainly do that here as well, or I can use any of the other keywords such as “Yesterday,” “Week to date,” “Month to date” and “Year to date.” There is also a -before argument if we ever need to discover objects created or modified before a certain date.
- -includeDep – This adds dependent objects into the package. For example, if I created a new report which is dependent on a specific table, both objects will be added.
- -package “C:\Temp\newObjects.spk” – Names the package that will be created with my modified objects. This argument is required.
- -objects “/Enterprise” – Specifies the folder where I want to start the search. This argument can also filter for specific types of objects if needed.
- -noexecute – Lists the objects to export but does not create the package. I used this so we could see what the package would contain.
The command results show that my export package would contain two folder objects, two report objects, one table object and one library object.
ExportPackage is but one of many useful commands available as part of the SAS Platform Object Framework. SAS administrators needing to script repeatable actions should become familiar with these tools which are documented in the SAS® 9.4 Intelligence Platform: System Administration Guide, Fourth Edition.
2 Comments
SMC 9.4_M3 has a search option which I've found useful.
Allows searches through metadata by modified date and folder location.
kr Rudy
Good point, Rudy, it is always good to have options!