How to Remove Leading or Trailing Spaces from a Data Set
Leading and trailing spaces in a data set are like termites in your house. If you don’t realize they are there and you don’t get rid of them, they’re going to wreak havoc.
Here are a few easy ways to remove these pesky characters with Minitab Statistical Software prior to analysis.
If you’re importing data from Excel, a text file, or some other file type:
- Choose File > Open and select your Excel file, text file, etc.
- Click Options and select Remove nonprintable characters and extra spaces.
- Click OK.
Note: This feature was introduced in Minitab 17.3. If you have an older version of Minitab 17, use Help > Check for Updates. If you have Minitab 16 or earlier—or you don't have Minitab at all—you can download a free 30-day trial.
Suppose you already have your data in Minitab, located in column C1:
- Choose Calc > Calculator.
- In Store result in variable, enter a blank column (e.g. C5), or you can overwrite an existing column.
- In Expression, enter TRIM(C1).
- Click OK.
If you also want to remove all non-printable characters using the Calculator, CLEAN is available as well.
And that’s all there is to it.