SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 31584: Creating a Key-Value-Table

DetailsCodeResultsAboutRate It
Key-Value tables differ from typical analysis datasets as they do not have an own column for each variable. Key-value tables typically have one column that holds all variables values and a separate key variable that denotes the variable that is measured.

Person Key Value
1 Gender Male
1 Age 37
2 Gender Female
2 Age 25

This sample shows, how this data structure can be built from an analysis dataset that looks like:

Person Gender Age
1 Male 37
2 Female 22

Key-value tables are needed for association analysis (in this case we would concatenate Gender and Age to one variable) or in specific database and data warehouse structures.

This sample was authored by Gerhard Svolba. His book, Data Preparation for Analytics is available from the SAS Publishing online bookstore.


These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.