BookmarkSubscribeRSS Feed

Getting your data from LASR to CAS

Started ‎05-28-2019 by
Modified ‎05-28-2019 by
Views 2,100

The GEL team recently moved our internal reporting environment from Visual Analytics on 9.4 to Visual Analytics on Viya. We used the 9.4 to Viya promotion tools documented here to move the reports and explorations. As part of the process we wanted to keep the two environments running in parallel. Running the environments in parallel is very helpful in validating the content and appearance of the reports after they are imported to Viya. One of the really helpful things in keeping the two environments running in parallel was the ability to keep the data in LASR and refresh the CAS data from the 9.4 LASR server.

 

SAS Viya promotion tools support export and import of LASR servers and libraries from SAS 9.4 to Viya. In the article I will show how this is done by exporting a LASR Server and library from SAS 9.4, importing them to Viya.

 

Exporting LASR Servers and Libraries

Viewing the LASR server in SAS 9.4 Visual Analytics administration show that it has two in-memory tables.

 

lasrTOcas01.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

In SAS 9.4 use the import/export wizard in SAS Management Console to export the LASR servers to Viya. On the Folders tab in SAS Management Console, navigate to SAS Folders > System > Servers, right-click and select Export SAS Package and give the package a name.

 

Repeat the process to export the HR Lasr Library from SAS 9.4. to a different package file.

 

Importing LASR Servers and Libraries to Viya

The LASR server package is not actually imported to Viya, it is used in the import process to create properties within a Viya Mapping File. The properties are then used to provide default values for a new Caslib which will connect to the 9.4  LASR server. To create the initial mapping file use the transfer command-line interface.

 

sas-admin transfer generate-content-mapping --mapping c:\temp --server-package "C:\Users\94packages\lasr_servers.spk"

 

By default the mapping file is called ContentMapping.json.

 

lasrTOcas03.png

 

The mapping file contains substitution properties that will become properties of a new LASR based Caslib in Viya. The file is then used in the next step when the LASR library is imported.

 

The LASR Library package can be imported in SAS Environment Manager or using the transfer CLI. In SAS Environment Manager, in the content area select Import and select the LASR library package. In the import wizard Mapping tab openthe mapping file that was created from the LASR server.

 

In the Additional Mappings tab map the LASR server to the CAS server.

 

lasrTOcas04-1024x371.png

 

Under Substitution Properties keep the new values and old values the same.

 

lasrTOcas05-1024x399.png

 

Complete the import process to create your LASR based CASLIB. The mapping file will be supplemented by the process and you can save a new mapping file at the end of the process.

 

lasrTOcas06.png

 

Before you use it the LASR Caslib will require a Viya authentication domain. An authentication domain makes a set of credentials available to a set of users, in this case the credentials are those needed to access the SAS 9.4 LASR Server. The authentication domain was not created by the import process, it can be created in the SAS Environment Manager Security area.

 

With the authentication domain defined, if you browse to the LASR based Caslib in SAS Environment manager you should see the LASR tables in the source of the LASR Caslib.

 

Loading Data from LASR to CAS

The data can be loaded into memory in CAS from the LASR server using the new caslib.

 

To transfer the data to CAS, create a new path-based Caslib an a cross-load from the LASR based caslib to the new path-based caslib. This will take the data from LASR, load it into the memory inf the new  path-based caslb and then persist it as a sashdat file in the source directory . In the future we can load directly from the source of the path-based CASLIB or refresh the data from the LASR server.

 

The program below uses PROC CAS to:

  1. Load the LASR data from the LASR Caslib into memory in the path-based Caslib
  2. Persist the data as a sashdat file in the source path of the path-based Caslib
cas dataimportsess;

proc cas;

/* drop the current table if it exists */

table.droptable / caslib=”HR Caslib” name=”LONGCOMMUTE” quiet=”TRUE”;
table.droptable / caslib=”HR Caslib” name=”HRDATA” quiet=”TRUE”;

/* Load the table from the LASR caslib to the memory space of the target caslib */

table.loadtable / caslib=”HR – LASR Library” path=”LONGCOMMUTE” casout={caslib=”HR Caslib”,name=”LONGCOMMUTE”,promote=TRUE};

table.loadtable / caslib=”HR – LASR Library” path=”HRDATA” casout={caslib=”HR Caslib”,name=”HRDATA”,promote=TRUE};

/* save the table as a caslib in the source of he target path caslib */

table.save / caslib=”HR Caslib” name=”LONGCOMMUTE”  table={caslib=”HR Caslib”,name=”LONGCOMMUTE”} permission=”GROUPWRITEPUBLICREAD” replace=True;

table.save / caslib=”HR Caslib” name=”HRDATA”  table={caslib=”Shared Data”,name=”HRDATA”} permission=”GROUPWRITEPUBLICREAD” replace=True;
quit;

cas  dataimportsess terminate;

 

It can be very convenient when transitioning from 9.4 and LASR to Viya and CAS to keep your data in LASR and access it in CAS. As you have seen, it is also quite easy when the time comes to move the data completely into the CAS server. I hope you find the useful.

Version history
Last update:
‎05-28-2019 12:50 PM
Updated by:
Contributors

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags