I'd like to create a cross reference table with hierarchies, this is my first time trying it.
First of all, I have no ideia how is the better table structure to work on hierarchy, so you guys could help on it.
I've this table below:
And my goal is show the result like that:
Does anybody know if is possible to reach this result according my table or I need to create another table with new structure?
A hierarchy is an arrangement of category columns that is based on parent-child relationships. The supporting data table should contain a variable (column) for each item to be arranged in the hierarchy. Using your example, your data would need to be set up as follows.
ID | Description | Type | Subtype1 | Subtype2 | Date | Quantity |
0 | SAP. A NUM 34 | PRODUTOS | SAPATOS | SAPATO MARCA A | 10/25/2019 | 200 |
1 | SAP. A NUM 36 | PRODUTOS | SAPATOS | SAPATO MARCA A | 10/25/2019 | 150 |
2 | SAP. B NUM 32 | PRODUTOS | SAPATOS | SAPATO MARCA B | 10/25/2019 | 250 |
3 | SAP. B NUM 36 | PRODUTOS | SAPATOS | SAPATO MARCA B | 10/25/2019 | 130 |
4 | ROU. A SIZE 4 | PRODUTOS | ROUPAS | ROUPA MARCA A | 10/25/2019 | 200 |
5 | ROU. A SIZE 7 | PRODUTOS | ROUPAS | ROUPA MARCA A | 10/25/2019 | 150 |
6 | ROU. B SIZE 3 | PRODUTOS | ROUPAS | ROUPA MARCA B | 10/25/2019 | 250 |
7 | ROU. B SIZE 5 | PRODUTOS | ROUPAS | ROUPA MARCA B | 10/25/2019 | 130 |
A hierarchy is an arrangement of category columns that is based on parent-child relationships. The supporting data table should contain a variable (column) for each item to be arranged in the hierarchy. Using your example, your data would need to be set up as follows.
ID | Description | Type | Subtype1 | Subtype2 | Date | Quantity |
0 | SAP. A NUM 34 | PRODUTOS | SAPATOS | SAPATO MARCA A | 10/25/2019 | 200 |
1 | SAP. A NUM 36 | PRODUTOS | SAPATOS | SAPATO MARCA A | 10/25/2019 | 150 |
2 | SAP. B NUM 32 | PRODUTOS | SAPATOS | SAPATO MARCA B | 10/25/2019 | 250 |
3 | SAP. B NUM 36 | PRODUTOS | SAPATOS | SAPATO MARCA B | 10/25/2019 | 130 |
4 | ROU. A SIZE 4 | PRODUTOS | ROUPAS | ROUPA MARCA A | 10/25/2019 | 200 |
5 | ROU. A SIZE 7 | PRODUTOS | ROUPAS | ROUPA MARCA A | 10/25/2019 | 150 |
6 | ROU. B SIZE 3 | PRODUTOS | ROUPAS | ROUPA MARCA B | 10/25/2019 | 250 |
7 | ROU. B SIZE 5 | PRODUTOS | ROUPAS | ROUPA MARCA B | 10/25/2019 | 130 |
@Robert_T, Thanks a lot for your answer.
My content is dynamic, I cannot control the relationships so I'm not sure that it could be done by my data.
Through my current table structure, each register pointing to his "parent", there is no way to work with hierarchies?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.