In a SAS Viya 3.2 environment two types of content can be created: SAS Visual Analytics Reports and Data Plans. For administrators, who may want to manage that content within a folder structure, there are some things to keep in mind. In the current release, both types of content can be moved around in folders, but the objects cannot be copied. In addition, SAS Viya 3.2 supports the promotion of SAS Visual Analytics Reports, but doesn’t support the promotion of Data Plans (support for Plans is coming in SAS Viya 3.3). So, what if I want to copy a report between, say my personal folders, to a production folder?
If you want copy a Report or Data Plan within an environment there is an easy way. When the object is open in edit mode you can do a Save As to save a copy to a different location in the folder structure.
Between environments, Reports can be exported and imported using the SAS transport services. What about Data Plans between environments? In this post, I will show you a neat way to export and importing data plans. The same approach can also be used for individual reports.
In the SAS Visual Data Builder and SAS Visual Analytics, when you are editing your content (Report or Data Plan) you can access a “diagnostics” window. The diagnostics window will show you the json (or xml) used to render the Report or Plan. To enter the diagnostics window use the keystrokes:
- ctl+alt+d for SAS Visual Data Builder.
- ctl+alt+b for SAS Visual Analytics.
In the steps below I will use the diagnostics window to save a Data Plan so that it can be loaded to a different SAS Viya Environment. The steps for a SAS Visual Analytics report are very similar.
In SAS Visual Data Builder when editing your Data Plan select ctl-alt-d to open the SAS Visual Data Builder Diagnostics window. The source tab of the window shows the json that will render the data plan.
Click Save to save the json to a text file and close the dialog. The json file will be saved in the browsers default downloads folder.
Copy the saved text file to a location accessible to the SAS Viya environment where you want to import the plan. In that environment, open Data Builder and click New to open a new Data Plan.
Click ctl-alt-d on the empty data plan and cut and paste the json from your text file replacing the json in the diagnostics window.
Click Parse to check the json.A message should be displayed indicating that the “plan text was parsed successfully.” Once you have parsed the text, click Run and the plan is loaded into SAS Visual Data Builder.
In SAS Visual Data Builder, select Save As and save the plan to any location in the folder structure.
The assumption with this approach is that the data is available in the same location in both environments.
You can do much the same with SAS Visual Analytics reports. The key-stroke is ctl-alt-b to open the SAS Visual Analytics Diagnostics window. You can see the report xml or json on the BIRD tab.
To copy a single report between environments, you can select json and then save the json to a file. In the target environment open a new report, paste the json in the BIRD tab, parse and load and then save the report to a folder. This can be a useful approach if you want to relocate a report to a different location in your target environment. The transfer service currently will only import reports to the same folder location in the target that they are located in the source environment.
I hope you found this tip useful.
Is there a better way to migrate reports than copying JSON of each individual report? We have several reports that we'd like to migrate seamlessly. Also, it would be helpful if you'd share something on how to migrate images stored in the SAS Infrastructure Data Server.
Hi Anurag, Gerry's out of the office but I reached out to a team member and received this reply: Yes, there is definitely a better way to do this for many reports. The export plugin to the sas-admin command supports exporting entire folders of reports in one go so you may want to look into using that method. If your report contains an image it should come along with the report without you having to export/import the images separately.
Thanks for the tips, Gerry! Do you know where Viya stores images, e.g., if you add an image to a report - is there a place in config where you can grab the physical images to move between environments?
Hi Daria, Gerry's out of the office but images you add to reports are persisted in the SAS Infrastructure Data Server by the files microservice. If you export the report from Viya, the images in that report are included in the transfer package and will be available to the imported version of the report. -Scott