ReshapeWide¶
ReshapeWide is not supported in the current version of SDTL, because it depends on values in the data. However, it may be useful when values of the index variable are available in the metadata file or the data can be processed.
Properties¶
Name | Type | Description | |
---|---|---|---|
MakeItems | ReshapeItemDescription | 0..n | New variables created by this command. |
IDVariables | VariableReferenceBase | 0..1 | One or more variables identifying unique rows in the wide data. |
DropVariables | VariableReferenceBase | 0..1 | Variables to be dropped from the new dataset. |
KeepVariables | VariableReferenceBase | 0..1 | Variables to be kept in the new dataset. |
Properties Inherited from TransformBase¶
Name | Type | Description | |
---|---|---|---|
ProducesDataframe | DataframeDescription | 0..n | Signify the dataframe which this transform produces. |
ConsumesDataframe | DataframeDescription | 0..n | Signify the dataframe which this transform acts upon. |
Properties Inherited from CommandBase¶
Name | Type | Description | |
---|---|---|---|
Command | string | 1..1 | The type of command |
SourceInformation | SourceInformation | 0..n | Information about the source of the command. |
MessageText | string | 0..n | Adds a message that can be displayed with the command. |
Item Type Hierarchy¶
- CommandBase
- TransformBase
- ReshapeWide
Relationships¶
ReshapeWide_Stata_Examples¶
Example 1: ``` reshape wide inc ue, i(region id) j(year)
- {“command”: “ReshapeWide”,
- “MakeItems”: [
- “ReshapeItemDescription”:
{“$type”: “ReshapeItemDescription”, “SourceVariableName”: “inc”, “Stub”: “inc”,
“IndexVariableName”:”year”,“IndexValues”: {“$type”:”NumberRangeExpression”,
“From”: “80”, “To”: “83”, “By”: “1”}},
- “ReshapeItemDescription”:
{“$type”: “ReshapeItemDescription”, “SourceVariableName”: “ue”, “Stub”: “ue”, “IndexValues”: {“$type”:”NumberRangeExpression”,
“From”: “80”, “To”: “83”, “By”: “1”}}
],
- “IDVariables”: [
- {“$type”: “VariableSymbolExpression”,”VariableName”: “region”}, {“$type”: “VariableSymbolExpression”,”VariableName”: “id”} ],
}
Long format Centre MetricTable QMetric Status Records PX001 RawCombinedResidencyfile Starts legal 50 PX001 RawCombinedResidencyfile Starts illegal 10 PX001 RawCombinedResidencyfile Transitions legal 57 PX001 RawCombinedResidencyfile Transitions illegal 3 PX001 RawCombinedResidencyfile Ends legal 60 PX001 RawCombinedResidencyfile Ends illegal 0 PX001 RawCombinedResidencyfile SexValues legal 60 PX001 RawCombinedResidencyfile SexValues illegal 0 PX001 RawCombinedResidencyfile DoBValues legal 60 PX001 RawCombinedResidencyfile DoBValues illegal 0
Wide format Centre MetricTable QMetric Illegal Legal PX001 RawCombinedResidencyfile Starts 10 50 PX001 RawCombinedResidencyfile Transitions 3 57 PX001 RawCombinedResidencyfile Ends 0 60 PX001 RawCombinedResidencyfile SexValues 0 60 PX001 RawCombinedResidencyfile DoBValues 0 60 ```
Stata: reshape wide records, i(Centre MetricTable QMetric) j(Status)
``` {“command”:”ReshapeWide”,
- “MakeItems”:[
“ReshapeItemDescription”: {“SourceVariableName”:”Records”,
“Stub”:””, “IndexVariableName”:”Status”, “IndexValues”: {“$type”:”StringListExpression”,
“values”:[ “illegal”, “legal”] } }],
- “IDVariables”:[
- {“$type”: “VariableSymbolExpression”,”VariableName”:”Centre”}, {“$type”: “VariableSymbolExpression”,”VariableName”:”MetricTable”}, {“$type”: “VariableSymbolExpression”,”VariableName”:”QMetric”} ]
}