BookmarkSubscribeRSS Feed
alisio_meneses
Obsidian | Level 7

 

Hello there.

 

I have a CSV file with two fields: an INT32 and a VARBINARY. This file was exported from a SAS Viya 3.5 CAS Table using Data Explorer. I imported this CSV into another SAS environment within CAS, and the resulting table has two fields: a varchar and a double. I need to convert the data types to varbinary and int32. I tried using a data step to perform the conversion, but it appears that data steps and procs are not compatible with INT32 and VARBINARY fields (according to this SAS document: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/pgmdiff/n0b6wc0bp6tt31n1l98k9g2l2l9b.htm).

 

Does anyone knows How can I perform these types of conversions?


PS: Original Table exported to CSV:

alisio_meneses_0-1691418103018.png

Table resulted from importing the CSV file:

alisio_meneses_1-1691418363781.png

 

 

2 REPLIES 2
Tom
Super User Tom
Super User

Perhaps someone with PROC DS2 experience can help with generating those non-SAS data types.

 

But from your picture of the description of the source table it looks like you can just read the INT32 value into a normal numeric variable since it says it has a maximum of 12 significant digits.

 

Not sure what a VARBINARY field is but if you read the field using $CHAR informat it should allow you to store any bytes that it might contain. 

 

But if the actual content of the field contained bytes with a value of '2C'x then trying to store the values into a CSV file is probably not a good idea.

 

Perhaps you should have written out a fixed length file with 4 bytes for the 32 bit integer and 164 bytes for the VARBINARY field.

alisio_meneses
Obsidian | Level 7

Hello @Tom.

 

Regarding the VARBINARY field: the original table, the one exported to CSV, was generated using the 'save' Action from the 'Tables' Action Set. It contains attributes from another table and includes a field with this data type (along with another field of type INT32).

 

The issue I'm facing is that I'm attempting to transfer data between different SAS Viya environments while trying to maintain the same table attributes.

 

proc cas;
   ldaTopic.ldaScore /
      docDistOut={caslib='acaslib', name="documents",
                  replace=TRUE
                 }
      docId="documents_id"
      modelTable={caslib="Public", name="lda_topics"}
      table={caslib="acaslib", name="input_prepared"}
      text={{name="text_prepared"}};
   run;
quit;   

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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