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
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.
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?
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
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.
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 processing
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!
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.
Ready to level-up your skills? Choose your own adventure.