Additional attribute for alternative variable names

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Additional attribute for alternative variable names

John F Hall

I am working with data sets which have effectively the same variables, but with different variable names.

  

In the sequential convention variables will be called V1 to Vn or VAR00001 to VARn.   Unless the questionnaires marked up with the sequences, this makes it difficult to work direct from the questionnaire.


In the positional  convention (dating from the days of 80-column cards, later from card images on mag tape) variable names were derived from the record and start column of the data for that variable: thus v2317 indicates the variable starting on col 17 of record 23  (field-widths vary).  Most questionnaire from those days were marked up with record and field for data-prep.  This makes it very easy to  use *.sav files with the questionnaire to hand.


The mnemonic convention has (sometimes quite tortuous if 8-character only) names which can be different for what is effectively the same variable in different surveys.  This can make variables difficult to find in *.sav files and dialog boxes.  Unless the variable names are super-imposed on the questionnaire files in the documentation,  it is extremely difficult for anyone other than the original researcher(s) to work direct from the questionnaire.


Working with a small selection of variables can be done manually, but tediously.  Working with whole files would be daunting.


Would it be possible using something like Data >> New Custom Attribute to create  alternative names which could be used as look-up tables when combining data from different files?  Because of the penchant for mnemonics in current major surveys, eg: British Social Attitudes Survey (BSAS), European Social Survey (ESS) and the NORC General Social Survey (GSS) the best solution would be a facility for converting positional to mnemonic and for choosing which mnemonic name to use.


Thanks in advance for applying your collective inspired genius.


John F Hall

[Retired academic survey researcher]

IBM-SPSS Academic author 9900074

 

Email:        johnfhall@... 

Website:   http://surveyresearch.weebly.com/

Course:     http://surveyresearch.weebly.com/1-survey-analysis-workshop-spss.html

Research: http://surveyresearch.weebly.com/3-subjective-social-indicators-quality-of-life.html

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Additional attribute for alternative variable names

John F Hall

Mario

Thanks for the suggestion.  Looks a bit hairy to non-Python user, but I'll try it on some dummy data.  I was thinking more of adding extra columns in the Data Editor with alternative varnames, but I've never actually tried it, so dummy data again, unless JK Peck or D Marso come up with something brilliant.  If I produce something close to what i want I'll post a screenshot or a dummy data set to Nabble.

John

 

John F Hlall

[Retired academic survey researcher]

IBM-SPSS Academic author 9900074

 

Email:        johnfhall@... 

Website:   http://surveyresearch.weebly.com/

Course:     http://surveyresearch.weebly.com/1-survey-analysis-workshop-spss.html

Research: http://surveyresearch.weebly.com/3-subjective-social-indicators-quality-of-life.html

 

 

 

 

 

 

> Message du 01/09/17 14:01
> De : "Mario Giesel" <[hidden email]>
> A : "John F Hall" <[hidden email]>, "[hidden email]" <[hidden email]>
> Copie à :
> Objet : Re: Additional attribute for alternative variable names
>
>
Hi, John,
  how about sth. like
>

>
BEGIN PROGRAM PYTHON.
import spss
syntax = ["RENAME VARIABLES ({} = x{}).".format(spss.GetVariableName(i), str(i).zfill(3)) for i in xrange(spss.GetVariableCount())]
print '\n'.join(syntax)
END PROGRAM.

GL,
  Mario

>
 

>
>
John F Hall <[hidden email]> schrieb am 10:28 Freitag, 1.September 2017:
>

>
>
I am working with data sets which have effectively the same variables, but with different variable names.
  
In the sequential convention variables will be called V1 to Vn or VAR00001 to VARn.   Unless the questionnaires marked up with the sequences, this makes it difficult to work direct from the questionnaire.

>
In the positional  convention (dating from the days of 80-column cards, later from card images on mag tape) variable names were derived from the record and start column of the data for that variable: thus v2317 indicates the variable starting on col 17 of record 23  (field-widths vary).  Most questionnaire from those days were marked up with record and field for data-prep.  This makes it very easy to  use *.sav files with the questionnaire to hand.

>
The mnemonic convention has (sometimes quite tortuous if 8-character only) names which can be different for what is effectively the same variable in different surveys.  This can make variables difficult to find in *.sav files and dialog boxes.  Unless the variable names are super-imposed on the questionnaire files in the documentation,  it is extremely difficult for anyone other than the original researcher(s) to work direct from the questionnaire.

>
Working with a small selection of variables can be done manually, but tediously.  Working with whole files would be daunting.

>
Would it be possible using something like Data >> New Custom Attribute to create  alternative names which could be used as look-up tables when combining data from different files?  Because of the penchant for mnemonics in current major surveys, eg: British Social Attitudes Survey (BSAS), European Social Survey (ESS) and the NORC General Social Survey (GSS) the best solution would be a facility for converting positional to mnemonic and for choosing which mnemonic name to use.

>
Thanks in advance for applying your collective inspired genius.

>
John F Hall
[Retired academic survey researcher]
IBM-SPSS Academic author 9900074
 
Email:        johnfhall@... 
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

>
>
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD