Sometimes we may need to format the data in a different way for specific analysis or to break down the data for further analysis.
Primarily, the Format Data tool can be used to quickly stack and unstack columns to change the way the data has been formatted.
The stacking of columns means that data has been collected in separate columns and they need to be stacked on top of each other. The stacking of columns will always result in all the column data getting merged into one column and the subscripts for this data is the name of the column. On the other hand, the unstacking of columns is taking data that is in a single column and using the subscript to unstack this data into multiple columns.
This tool can also code the inputs when generating the outputs. For example, we can code "No" to 0 and "Yes" to 1. So, if any of the input columns contain the value "No" then when generating the output, a value of 0 would be written. Coding applies to all columns and any value on the input side is coded no matter which column it is in.
You may also specify how to handle any missing or blank values during the stacking and unstacking operation. You may choose to ignore the missing values in which case any missing values will continue to remain missing in the output. You can delete only that particular missing value but retain the remaining values. You should be careful with this option especially if you have cross-sectional data. Finally, you can delete the entire row if any value is missing in any column. This option works well for cross-sectional data but may reduce your data size for subsequent analysis.
Click on Analysis Setup to open the menu options for this tool.
A sample screenshot of the setup menu is shown below.
Specify if you want to stack or unstack your input data.
Stacking the data means converting data that is stored in multiple columns into two columns so that one column has the group number and the second column has your data points.
Unstacking is the reverse process where the data is coverted from grouped format to individual columns.
If you specify no change, then the original data formating is preserved.
Specify how you want to handle missing values in your original data set.
Ignore the missing values in the data. The output format will also contain these missing values.
Delete the entire row if any one of the input rows has missing values. Each row is treated as one related set.
Delete only those values that are missing and retain the remaining values that are not missing. Note that each row is not treated as one set.
Click on this button to open the help file for this topic.
Click on this button to cancel all changes to the settings and exit this dialog box.
Click on this button to save all changes and compute the outputs for this analysis.
If you click on the Data button, you will see the following dialog box. Here you can specify the data required for this analysis.
The available data displays all the columns of data that are available for analysis. You can use the search bar to filter this list and to speed up finding the right data to use for analysis. Enter a few characters in the search field and the software will filter and display the filtered data in the Available Data box.
The available data box contains the list of data available for analysis. If your workbook does not have any data in tabular format, this box will display "No Data Found". The information displayed in this box includes the row number, whether the data is Numeric (N) or Text (T), and the name of the column variable. Note that the software displays data from all the tables in the current workbook. Even though data within the same table have unique column names, columns across different tables can have similar names. Hence, it is important that you not only specify the column name but also the table name.
Add or View Data:
Click on this button either to add more data into your workbook for analysis or to view more details about the data listed in the available data box. When you click on this button, it opens up the Data Editor dialog box where you can import more data into your workbook, or you can switch from the list view to a table view to see the individual data values for each column.
The code for the required data specifies what data can be specified for that box. An example code is N: 2-4. If the code starts with an N, then you will need to select only numeric columns. If the code starts with a T, then you can select both numeric and text columns. The numbers to the right of the colon specify the min-max values. For example, if the min-max values are 2-4, then you need to select a minimum of 2 columns of data and a maximum of 4 columns of data in this box. If the minimum value is 0, then no data is required to be specified for this box.
Click on this button to select the data for analysis. Any data you select for the analysis is moved to the right. To select a column, click on the columns in the Available Databox to highlight them and then click on the Select Button. A second method to select the data is to double click on the columns in the list of Available Data. Finally, you can also drag and drop the columns you are interested in by holding down the select columns using your left mouse key and dragging and dropping them in one of the boxes on the right.
If the right amount of data columns has been specified, the list box header will be displayed in the black color. If sufficient data has not been specified, then the list box header will be displayed in the red color. Note that you can double-click on any of the columns in this box to remove them from the box.
The data you specify for this analysis depends on the options you have specified in the Setup tab.
If Stack Columns is set to Stack Data then you need to specify the columns that you want to stack under Analysis Variables. The Grouping Variables is disabled.
If Stack Columns is set to Unstack Data then you need to specify your data column under Analysis Variables and the column that contains group information under Grouping Variables.
Click on this button to view the data you have specified for this analysis. The data can be viewed either in a tablular format or in a graphical summary.
A sample screenshot of the code values menu is shown below.
Specify if you want to code the values. Coding is the process of replacing one value with another. You need to specify the From-To pairs for the coding to work. The same coding is applied across all columns.
If you have specified that option that you want to code values on Page 1 of the input dialog box, you can specify how you want to code the values on this page. Specify the old values in the first column. Every occurrence of the old values are replaced with the new values in your input data columns.
Specify the new values here. The old values will be replaced by the new values you specify here.
If you click on the Verify button, the software will perform some checks on the data you have entered. A sample screenshot of the dialog box is shown in the figure below.
The objective of this analysis as well as any checks that are performed is listed in this dialog box. For example, the software may check if you have correctly specified the input options and entered the required data on the worksheet. The results of the analysis checks are listed on the right. If the checks are passed, then they are shown as a green-colored checkmark. If the verification checks fail, then they are shown as a red-colored cross. If the verification checks result in a warning, they are shown in the orange color exclamation mark and finally, any checks that are required to be performed by the user are shown as blue info icons.
Click on Compute Outputs to update the output calculations. A sample screenshot of the worksheet is shown below. Check the outputs to make sure the transformation is what you expect, if not make appropriate changes and click on Compute Outputs.
There are no analysis outputs or graphs for this analysis. The data entered in the input columns are reformatted and displayed in the outputs area.
Here are a few pointers regarding this analysis:
You can manipulate up to 20 variables on the input side using this tool.
The unstack option requires that all the data be stored in 2 columns (subscript and data). Note that you will only see this option when you select the number of input variables as 2.
Following examples can be found in the Examples folder.
For the data given in the reference file, stack and unstack the requested columns. (Format Data 1.xlsm).