This article describes how to stack a data set in Displayr and save your settings so that you can automatically re-stack your data set when your data updates.
The output below shows the variables of a data set that have been stacked using common labels (blue) and manually stacked variables (pink):
In this example, Displayr was able to automatically detect 7 common labels and then stack the variables that included these labels. We were also able to manually map 2 variable sets that were affected by inconsistent labeling, and specify which non-stacked variables to include.
- Displayr Cloud Drive enabled on your account - contact Support to have access to this feature.
- A stackable data set that has been imported to the Displayr Cloud Drive via Profile icon > Displayr cloud drive > +Upload or by selecting the data set in the Data Sets tree > Publish > Export Data > To Displayr Cloud Drive as SPSS File (.SAV).
1. In the toolbar, go to Anything > Data > Data Set > Stack.
2. Under Input data set, enter the name and extension of the SPSS .sav file to be stacked, e.g. Cola.sav.
3. OPTIONAL: Enter the name of the stacked SPSS data file to be saved to the Displayr Cloud Drive. If none is specified, it will default to Input data set name + " stacked".
4. Select the method of stacking via the Stack with common labels field:
- Automatically - This is the default setting whereby a set of common labels is automatically chosen based on the variable labels in the input data set and variables with these common labels are stacked together.
- Using a set of variables to stack as reference - This lets you specify which variable set labels to use for identifying variables to be stacked.
- Using manually input common labels - This lets you manually specify the labels for identifying variables to be stacked.
- Disabled - Select this if you wish to instead manually specify the variables to be stacked.
5. OPTIONAL: If using a set of variables as a reference, you will need to enter a Reference variables to stack text input. Note, multiple sets of common labels can be specified.
Each text input should contain the comma-separated names of the reference variables to be used to determine a set of common labels which are used for stacking. Note, a set of consecutive variables can be specified using a range consisting of the name of the first and last variables separated by a dash (-). For example, variables Q1_A, Q1_B, Q1_C, Q1_D can be specified as Q1_A-Q1_D. You can also use a wildcard character (*) when dealing with common prefixes and/or suffixes, for example, Q1_*.
6. OPTIONAL: If manually inputting the labels, you will need to enter a Common label text input for each item to be stacked. Note, multiple sets of reference variables can be specified for multiple sets of common labels.
7. OPTIONAL: In addition to the Stack with common labels setting, you can include manual stacking conditions under Manually specify stacking by. You have a choice between Variable and Observation. Depending on the variables to be stacked, it may be a lot easier specifying variables using one of the methods compared to the other.
8. OPTIONAL: If manually stacking by Variable, each text input should contain the names of the variables to be stacked together into one variable. Here, we will manually stack 2 variables using Q6_* and Q9_*.
9. OPTIONAL: If manually stacking by Observation, each text input should contain the name of the variable to be stacked in an observation. Here, we would need to enter Q6_A,Q6_B,Q6_C and so on separately.
10. OPTIONAL: Enter any variable names you wish to include as non-stacked variables in your new data set under Non-stacked variables to include. Here, we will enter Q31,Q32.
11. OPTIONAL: Untick Include original case variable in stacked data set if you don't wish to include a variable containing the original case numbers.
12. OPTIONAL: Untick Include observation variable in stacked data set if you don't wish to include a variable containing the observation numbers.
13. OPTIONAL: Tick Automatic updating if you wish for the stacked data set to be regularly updated. Selecting this will then add the below options:
- Update period - Enter the time unit for regular updates. e.g. Hours, Days, Months.
- Frequency - Enter the frequency of the update period.
- Start date and time - The date and time of the first update in the format dd-mm-yyyy hh:mm or mm-dd-yyyy hh:mm.
- US date format - If specifying the start date/time, you can confirm whether it should be expressed in US format i.e. mm-dd-yyyy hh:mm.
- Time zone - If specifying the start date/time outside of UTC, you can confirm the time zone in the Continent/City format e.g. America/Los_Angeles. See Wikipedia for a list of time zones.
14. Import your newly saved data set from the Displayr Cloud Drive via Data Sets > Plus (+) > Displayr Cloud Drive. If you set the automatic refresh frequency, this will ensure your data set automatically updates with the latest stacked data.