BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
crack3n-collab
Obsidian | Level 7

I am doing object detection for PPE and I have Jupyter code that requires the input(images/annotations) to be in Sashdat format.  I don't have much experience with CAS tables and caslibs but I do know CAS tables can be converted into the SASHdat format. So right now I am stuck with creating the CAS table and caslibs, I do not know how to generate them. Any help will be very much appreciated.

 

Link to code:

https://github.com/sassoftware/python-dlpy/blob/master/examples/object_detection/SimpleObjectDetecti...

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

@crack3n-collab wrote:

So based on what you have said. Am I right to say I need to first set up a CASlib and a CAS table to get sashdat? Do you know of any Python code to convert a cas table to sashdat?


The data you work with is the CAS in-memory table. The .sashdat file is just the file in the backing store - and you could also use another format like parquet.

For CAS using .sashdat has advantages when it comes to loading because .sashdat is memory-mapped. 

 

See if the info under below two links give you more guidance.

4 Rules to Understand CAS Management of In-Memory Data

Save a Table to a Caslib as a SASHDAT File

View solution in original post

6 REPLIES 6
Patrick
Opal | Level 21

Looking into the code under the link you've shared it appears what you get as source in a zip file are .sashdat files. The instructions and code then show you how to load this .sashdat file into CAS.

 

CAS tables are in-memory tables. Caslib's point to such in-memory tables. A Caslib has always two legs: The in-memory table and a backing store that points to a physical location. 

 

What you need to do is to store the unzipped .sashdat files under a physical location accessible to your CAS session and then use this path for the caslib definition as the backing store (path=...).

You then load the CAS table from the backing store.

 

I'm not really sure which example you're doing but it looks to me the instructions given are very detailed so just read and follow them carefully.

crack3n-collab
Obsidian | Level 7

Hi Patrick, thanks for the reply. I am doing the simple object detection example but I using a different set of model data. I have the images and annotation but the input file format in the code appears to require the .sashdat format.

Patrick
Opal | Level 21

CAS allows to use a big variety of source data (the physical leg). You just need to define it the right way.

 

In your sample code here the place where you define the caslib and where you likely need to amend the code.

Patrick_0-1703731650029.png

CAS action table.addcaslib() is documented here.

Once your caslib is correct you can load the data from the define backing store into CAS. You will of course again have to amend the sample code so it's suitable for your actual physical data.

Patrick_1-1703731851836.png

CAS action table.loadTable is documented here.

 

And here the link to the CAS table action set.

 

If it was me then I'd first get these CAS actions working using SAS Studio with Proc CAS and only then integrate the already working and tested code into the Python script.

 

 

crack3n-collab
Obsidian | Level 7

So based on what you have said. Am I right to say I need to first set up a CASlib and a CAS table to get sashdat? Do you know of any Python code to convert a cas table to sashdat?

crack3n-collab
Obsidian | Level 7

https://github.com/sassoftware/converting-sas-code-to-leverage-cas/blob/main/Save.CAS.Table.To.SASHD...

 

I found this SAS code on github but I am quite sure how I access it if I were do it on SAS Viya since I need the .sashdat file in jupyter hub. I can't download the .sashdat file because I am using a trial environment.

Patrick
Opal | Level 21

@crack3n-collab wrote:

So based on what you have said. Am I right to say I need to first set up a CASlib and a CAS table to get sashdat? Do you know of any Python code to convert a cas table to sashdat?


The data you work with is the CAS in-memory table. The .sashdat file is just the file in the backing store - and you could also use another format like parquet.

For CAS using .sashdat has advantages when it comes to loading because .sashdat is memory-mapped. 

 

See if the info under below two links give you more guidance.

4 Rules to Understand CAS Management of In-Memory Data

Save a Table to a Caslib as a SASHDAT File

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Discussion stats
  • 6 replies
  • 1838 views
  • 2 likes
  • 2 in conversation