2.2.3.80 wunstackcol
Menu Information
Restructure: Unstack Columns
Brief Information
Unstack data using group columns
Additional Information
Minimum Origin Version Required: 8.1 SR0
Command Line Usage
1. wunstackcol irng1:=2 irng2:=1 missing:=1;
2. wunstackcol irng1:=col(2) irng2:=col(1) nonstack:=1 other:=col(3);
3. wunstackcol -r 2 irng1:=(3:5) irng2:=col(2) sort:=data pos:=udl label:=L;
4. wunstackcol irng1:=[Book1]body!D"height":E"weight" irng2:=[Book1]body!C"gender" nonstack:=1 other:=[Book1]body!A"name" owStructured:=1 label:=L;
X-Function Execution Options
Please refer to the page for additional option switches when accessing the x-function from script
Variables
Display Name
|
Variable Name
|
I/O and Type
|
Default Value
|
Description
|
| Data to be Unstacked
|
irng1
|
Input
Range
|
<active>
|
Specify the data to be unstacked.
|
| Group Column(s)
|
irng2
|
Input
Range
|
<unassigned>
|
Specify the data to be the group. Unstacking columns is in accordance with this group.
|
| Include Other Column(s)
|
nonstack
|
Input
int
|
0
|
Specify whether to include those non-unstack columns in the original sheet to the result sheet.
|
| Other Column(s)
|
other
|
Input
Range
|
<optional>
|
Specify the data range(s) which will be the non-unstack column(s) to output to the result sheet. It is available when Include Other Column(s) is checked.
|
| Extract Rule for Other Columns Values
|
extract
|
Input
int
|
1
|
Specify how to arrange the data in Other Column(s).
Option list:
- longest:Matching Longest Group
- This option is used in the situation when the unstacked data has the same structure in Group Column(s) and Other Column(s). Note that before using this option to unstack columns, the data should be sorted first by Group Columns then by Other Column(s).
- combine:Combining All Groups
- Combine the data in Group Column(s) and the data in Other Column(s)and use it as index to unstack data in Data to be Unstacked.
|
| Include Missing as One Group
|
missing
|
Input
int
|
0
|
Specify whether to consider missing values as one group.
|
| Sort Output Coulmns By
|
sort
|
Input
int
|
0
|
Specify how to sort the output columns.
Option list:
- group:Group Variables
- Sort the output columns alphanumerically by group variable value. For example, group variable "Make" has two values, "Acura" and "Buick". After unstacking, the columns appear in the order "Acura", then "Buick".
- data:Data to be Unstacked
- Preserve the order of the Data to be Unstacked. For example, Data to be Unstacked = [Book1]Sheet1!(3,4). When unstacked, column 3 data columns are listed first; column 4 data columns follow. If Data to be Unstacked = [Book1]Sheet1!(4,3), then column 4 data columns are listed first; column 3 data columns follow.
|
| Output Worksheet
|
ow
|
Output
Worksheet
|
<new>
|
Specify where to store the output unstacked results.
|
| Output to Data Table
|
owStructured
|
Input
int
|
0
|
Check this checkbox to output the unstacked results to a Data Table. This option is available for one of the following conditions:
- number of Group Column(s) <= 2, and Include Other Column(s) has 1 column selected, the unstacked data will be output to a Grouped (Two-Way) table;
- number of Data to be Unstacked = 1 , number of Group Column(s) = 1, and Include Other Column(s) is unchecked, the unstacked data will be output to a Column (One-Way) table;
- number of Data to be Unstacked = 1, number of Group Column(s) = 3, and Include Other Column(s) has 1 column selected, the unstacked data will be output to a Grouped (Two-Way) table.
|
| Put Grouping Info. to
|
pos
|
Input
int
|
1
|
Specify where to put the grouping information.
Option list:
- lname:Long Name
- Put the grouping information to the Long Name row.
- comments:Comments
- Put the grouping information to the Comments row.
- append:Append to Data Column's Long Name
- Append the grouping information to the Long Name row.
- udl:User Defined Parameters
- Put the grouping information to the user defined parameter row, this row's name is specified by From Group Columns.
|
From Group Columns/ Dataset Identifier
|
label
|
Input
string
|
<unassigned>
|
This drop-down list is only available when Put Group Info. to is set as User Defined Parameters, or Output to Data Table is checked.
- When Put Group Info. to is set as User Defined Parameters, From Group Columns is used to name the user defined parameter row for storing grouping information. The name is from the label row of the Group column in the source worksheet. The selected label row must contain a string for naming the user defined parameter row, or there will be an error message. Please refer to Column Label Row Characters for the single character to specify a label row.
- When Output to Data Table is checked, Dataset Indentifier is used to specify the column label row containing the indentifier.
|
Description
This X-Function is used to unstack columns by group columns. Please refer to this page in the User Guide for more information.
Related X-Functions
wstackcol, colsplit