I have a column called 'bp' whose type is 9~10 digits integers. However, it shows only upto 8th digit. Appreciate if you could let me know what is the problem.
You set the INFORMAT to read 8 characters, but you are NOT using that for anything in your code.
But in your INPUT() function call you also told it to only read 8 characters. Change that to use more characters. Go ahead and use 32 as that it max that the informat supports.
bp = input(....., ??32.);
You also might want to add a FORMAT statement to tell SAS how to display the value, although normally SAS will use BEST12. as the default and that should easily display 10 digit integers.
In the last data step you set the length of BP to 8 bytes (why you included a period in the LENGTH statement I don't know because2 lengths are always integer values). That shouldn't change the value as SAS always processes numbers using 8 byte floating point format. And if you did previous use a shorter length when create the data you are reading in that step the extra precision is lost so increasing it back to the normal 8 cannot find the missing bits of precision.
You set the INFORMAT to read 8 characters, but you are NOT using that for anything in your code.
But in your INPUT() function call you also told it to only read 8 characters. Change that to use more characters. Go ahead and use 32 as that it max that the informat supports.
bp = input(....., ??32.);
You also might want to add a FORMAT statement to tell SAS how to display the value, although normally SAS will use BEST12. as the default and that should easily display 10 digit integers.
In the last data step you set the length of BP to 8 bytes (why you included a period in the LENGTH statement I don't know because2 lengths are always integer values). That shouldn't change the value as SAS always processes numbers using 8 byte floating point format. And if you did previous use a shorter length when create the data you are reading in that step the extra precision is lost so increasing it back to the normal 8 cannot find the missing bits of precision.
Also,
length BP 8.;
is not valid syntax,
You are mixing format and length syntax.
You should have:
length BP 8;
Do not mix what variable length and format are. Especially for numeric variables.
Numeric variables should always have a length of 8 bytes, unless you have a good reason to change this, and you know about the dramatic consequences a different value can have.
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.