Reputation: 761
I have the variable labels and value labels in a table in my database, like this
id_variable_label | variable_label | id_value_label | value_label | id_father_label
---------------------------------------------------------------------------------------------------------
1 | father_label | null | null | null
null | father_label | 1 | child01 | 1
null | father_label | 2 | child02 | 1
Is there a way to generate automatically all the variables and value labels when I import the data from my database through a ODBC connection?
Upvotes: 0
Views: 1567
Reputation: 34917
You can use SPSS syntax to create variable and value labels.
See the SPSS commands VARIABLE LABELS
and VALUE LABELS
.
Here's a tutorial here that explains how you can use them.
You could generate the syntax from your database.
Upvotes: 1
Reputation: 5417
There isn't a direct way to do this, but if you read that table as an SPSS dataset, it would be pretty simple to generate the labels with a little Python code.
Note also that if your labeling is static, you can use APPLY DICTIONARY to copy labels from one dataset to another, so saving one fully labeled file would allow you to propagate that to others that are similarly structured.
Upvotes: 1