BookmarkSubscribeRSS Feed
alisio_meneses
Quartz | Level 8

 

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
Quartz | Level 8

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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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