BookmarkSubscribeRSS Feed
GirlHasNoName
Calcite | Level 5

I have a character variable in my dataset that I would like to use as an argument to the INPUT function and create a new numeric variable with a user defined informat. I have recently started using Studio in the Viya platform after working in SAS EG in the old platform where I can do this by using invalue statement in proc format to create the informat and then using that as the argument to the INPUT function.

 

When I try to replicate this in SAS Studio 5.1 (Viya Release V.03.04) by including a CAS format library, I get a note saying informats cannot be written to a CAS session (this is documented in the SAS Viya documentation as well) and so the user defined informat is created in WORK.formats. Referencing this informat to process my dataset in CAS via the INPUT function errors out saying the informat was not found or could not be loaded.

 

Any help for a workaround or suggestion to correct how I am trying to achieve this would be much appreciated.

 

Thanks

5 REPLIES 5
Astounding
PROC Star

Take a look at the FMTSEARCH option.  It tells SAS where to look for formats and informats.  You will need to add WORK.FORMATS to the list of whatever is currently in effect.

Tom
Super User Tom
Super User

Here is paper that explains how to move a FORMAT from work to CAS.

https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3331-2019.pdf

Perhaps a similar method will work for an INFORMAT?

GirlHasNoName
Calcite | Level 5

I had a go with Method 2 in this paper and got the same note

NOTE: Informats cannot be written to a CAS session, so the informat EXPECTATIONPRIORITY has been skipped.

Thanks for your time

Tom
Super User Tom
Super User

How complex is the INFORMAT?  If it is just one to one mapping then perhaps you can pull out the START and LABEL values from the informat's defintion and create a small table to join with instead of trying to use the INPUT() function.

GirlHasNoName
Calcite | Level 5

Not an elaborate informat at all and there are definitely other options to achieve what I need in this case but would be good to know if user defined informats cant be used in CAS processing at all?

To me, using informats is the more elegant, easy to understand, reproducible and portable option so really disappointed if they cant be used in CAS processingSmiley Indifferent

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1068 views
  • 0 likes
  • 3 in conversation