hello,
i use the odbc engine to retrieve data from a snowflake table. it contains a variable x of integers which seem to lose precision in sas. for example:
y = put(x, best32. -l);
i think that this is related to this question:
https://stackoverflow.com/questions/10933725/long-digit-reading-in-sas
as i do not use proc import, this does not help me much, though.
is it possible to convert a numeric snowflake variable into a sas character variable without losing precision?
Snowflake SQL contains functions to do column type conversions: https://docs.snowflake.com/en/sql-reference/functions-conversion.html
Just add the required conversion from numeric to character (VARCHAR) in a SAS passthru SQL query and then SAS will read the character version without any precision loss.
SAS precision for large numbers means that you will need to do the conversion before bringing it into SAS. Possibly export the data from the other data source and then read the data with a data step as character.
Snowflake SQL contains functions to do column type conversions: https://docs.snowflake.com/en/sql-reference/functions-conversion.html
Just add the required conversion from numeric to character (VARCHAR) in a SAS passthru SQL query and then SAS will read the character version without any precision loss.
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!
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.
Ready to level-up your skills? Choose your own adventure.