Hi,
I have a dataset like the following. I would like to format all those numeric values to no decimals. Like -8 -4 4 for the first line. But after I used the Proc Format, all the negative numbers are missing. Could you help me?
char1 char2 char3
-8.00000 -4 4.00
-8.00000 -4 14.00
6.00000 8 4.00
-1.00000 3 4.00
6.00000 3 14.00
6.00000 0 4.00
6.00000 0 4.00
11.00000 3 4.00
The variable names CHAR1, CHAR2, and CHAR3 sound suspiciously like character variables. Are they character or are they numeric?
If you have non-zero values after the decimal point such as -8.3000, what would you like the result to be? How about the result for an original value of -8.99?
You said you tried PROC FORMAT. What did you already try, that didn't work?
If the value is positive such as 8.0000, should it also lose the zeros?
The solution might be as simple as this:
char1 = scan(char1, 1, '.') ;
The harder part is spelling out the problem.
Show your proc format code.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.