- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Show your proc format code.