Maybe I missed something obvious, but here goes.
For each SAS/ACCESS engine, there is a table in the documentation that descibes the default mappings from the source (database) data type and the format it will have in SAS.
Is there a way to affect this mapping, on a library level?
I know that there is a DBSASTYPE= data set option, but that acts on individula columns. A bit awkward if you like this to be applied to a schema with potentially hundreds of columns of a certain data type.
My current example is that I want date to use YYMMDD10., not DATE9..
Hi @LinusH,
This is an exciting idea. Right now, there is no way to remap an entire LIBRARY in one fell swoop. I am going to create a feature request for your idea. I am thinking that a SAS data set containing the conversion details would be an excellent way to approach this. It is possible to remap SAS functions using a similar technique.
Thanks for posting this,
Jeff
Either that, or a Libname option similar to DBSASTYPE, like from data type to SAS format...
Thanks for the swift response!
There are lots of ways that SAS might do it. Another way, a bit clumsier but with other benefits, would be to allow FedSQL views to be used in base SAS; it seems to do the conversion automatically if you have declared data types correctly, but unfortunately FedSQLs are broken outside FedSQL.
I was thinking that a list in a libname (SASDATEFMT or DBSASTYPE) would be the way to go, but the suggestion of having the translation list stored in a data set is a good one. It would allow you to specify different data types for the same variable name in different data sets.
And if you think "No one would be so careless as to declare the same variable name in different ways in different data sets in the same library", haha, you haven't met our vendors.
@JackHamilton wrote:
And if you think "No one would be so careless as to declare the same variable name in different ways in different data sets in the same library", haha, you haven't met our vendors.
You will not get any push back from me on that point. I won't mention names but perhaps we have some of the same vendors...
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!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.