Hi, again.
I have a doubt.
Is there any way to recover numeric values like:
2.45 is formatted as comma10.2, but it's damaged, because this value comes like this 2.446,58 as string.
So the value of 2.45 is after i format the variable, but i need then like 2.446,58.
Is there any way to recover it ?
Tks,
Rodrigo Elias
But there are a lot more data like this.
I need to recover the table.
Tks
How did you try to convert the string to a number?
You can use the COMMA informat to read numbers in the normal format for your LOCALE setting.
Use COMMAX informat to read those where the roles of the comma and the period have been reversed.
38 data sample;
39 input str $20. ;
40 num1 = input(str,comma20.);
41 num2 = input(str,commaX20.);
42 put (_all_) (=);
43 cards;
str=1,234.56 num1=1234.56 num2=1.23456
str=1.234,56 num1=1.23456 num2=1234.56
Do you already have the values as numbers and no longer have the strings?
Print the number without a format (or using the BEST format).
You might just need to multiple by 1000 for that example.
But if the original number was less than 100 and it had 2 decimal places you would need to divide by 100.
If the original value was greater than a million then you probably have a missing numeric value.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.