- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
During analyzing financial data I came across a huge difficulty. Variable "total salary" looks like this:
75,879.00 or 123,679.00 or 7,987.00. Do you know how to delete commas and periods? They occure in different places.
Please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you want the numbers to display differently, assign another format. But mind that the display format does not influence any calculations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please describe what you are doing that the presence of either the comma or the decimal affects your analysis.
You may also want to run proc contents on that data set and share the variable type and format currently associated with the variable.
I suspect that the current format is some form of CommaW.D. The presence of the commas or decimals are very unlikely to have any impact on analysis though possible will have an effect on some reports.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What is the origin of your data? is it excel or any other external file or data base?
How do you import that file into sas?
I believe that the issue is the result of method importing the data to sas.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What is the variable type? Numeric that is formatted to display such or a character variable containing the above strings? Don't think you want to remove the period without also removing the zeroes that follow. Otherwise, it affects the value.
If it is a numeric variable type you can clear the format with:
format <variable> ;
If it is character, you can compress the comma out. I don't think you should delete the period as it would change the value. Here is a small demo: