I have a record with "7,5" is marked as string. When I try
input("7,5", 8.) or input("7,5", best.)
it returns . or null number. What is the problem here? How could we solve it?
It can be read with a comma informat:
But the comma format is very sensitive and makes factor 10 errors if there are no decimals or a different number of digits after the comma. So it is more secure to translate the comma to a point and use a standard numeric input format:
It can be read with a comma informat:
But the comma format is very sensitive and makes factor 10 errors if there are no decimals or a different number of digits after the comma. So it is more secure to translate the comma to a point and use a standard numeric input format:
Hi @vietlinh12hoa,
Do you want to separate the numbers or interpret the comma as a decimal?
The following might help:
data want;
/* separate the numbers */
x = input(scan("7,5",1), 8.);
y = input(scan("7,5",2), best8.);
/* comma in place of decimal point */
z = input("7,5",numx.);
run;
Thanks & kind regards,
Amir.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.