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.
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!
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.