Paste database dictionary/creation commands into syntax?

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

Paste database dictionary/creation commands into syntax?

Michael Pullmann
Hi all,
 
I have an online survey created through Catalyst. It is similar to an online survey we conducted last year. We would like to  merge these files (2011 and 2012).
 
Because it was created through Catalyst, and because we modified some of our survey items, many of the variable attributes are slightly different (variable width, etc). For the merge, these need to match.
 
We would like to paste last year's data attributes as a syntax file so we can easily modify it in order to alter this year's database attributes so the two match, to facilitate the merge. Or perhaps there is some other approach. The goal is to avoid having to re-create the data dictionary from scratch, while ensuring consistency between the datasets. We have added and removed some variables between 2011 and 2012, so I don't think that "apply data dictionary" would not work.
 
Any thoughts on how to approach this issue? I hope I've explained myself well enough.
 

Mike Pullmann
Research Assistant Professor
Division of Public Behavioral Health and Justice Policy
Department of Psychiatry and Behavioral Sciences
University of Washington
2815 Eastlake Ave. East, Suite 200  |  Seattle, WA 98102-3086
UW Box #358015
 
phone: 206.685.0408
fax:  206.685.3430
Reply | Threaded
Open this post in threaded view
|

Automatic reply: Paste database dictionary/creation commands into syntax?

Lorin Drake
I will be out of the office on Friday afternoon (8/3) and will respond to your email on Monday.
If your need is urgent, please call our switchboard and someone will direct your call: (813) 207-0332.
Reply | Threaded
Open this post in threaded view
|

Re: Paste database dictionary/creation commands into syntax?

Jon K Peck
In reply to this post by Michael Pullmann
You can use APPLY DICTIONARY to copy the variable dictionary from one sav file to another, but that cannot change the string widths, nor could ordinary variable dictionary syntax.

The only attributes that need to match for merging (besides the names) are variable type and string width.  You can use ALTER TYPE to change the widths (or types) appropriately.

Using programmability, you could construct an appropriate set of ALTER TYPE commands or generate syntax for variable specifications from an existing variable dictionary if needed.

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        Michael Pullmann <[hidden email]>
To:        [hidden email]
Date:        08/03/2012 11:19 AM
Subject:        [SPSSX-L] Paste database dictionary/creation commands into syntax?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi all,
 
I have an online survey created through Catalyst. It is similar to an online survey we conducted last year. We would like to  merge these files (2011 and 2012).
 
Because it was created through Catalyst, and because we modified some of our survey items, many of the variable attributes are slightly different (variable width, etc). For the merge, these need to match.
 
We would like to paste last year's data attributes as a syntax file so we can easily modify it in order to alter this year's database attributes so the two match, to facilitate the merge. Or perhaps there is some other approach. The goal is to avoid having to re-create the data dictionary from scratch, while ensuring consistency between the datasets. We have added and removed some variables between 2011 and 2012, so I don't think that "apply data dictionary" would not work.
 
Any thoughts on how to approach this issue? I hope I've explained myself well enough.
 

Mike Pullmann
Research Assistant Professor
Division of Public Behavioral Health and Justice Policy
Department of Psychiatry and Behavioral Sciences
University of Washington
2815 Eastlake Ave. East, Suite 200  |  Seattle, WA 98102-3086
UW Box #358015

 
phone: 206.685.0408
fax:  206.685.3430

Reply | Threaded
Open this post in threaded view
|

Automatic reply: Paste database dictionary/creation commands into syntax?

Mark Lenel

Hi,

 

Thanks for your message.  I am currently on vacation with no access to emails.  I will be back in the office on Tuesday 21st August.

 

Should you require a faster response, please call the office +44(0)1483 510310 and ask to speak to Crawford Christie, or email him on [hidden email].

 

Thanks!

 

Mark

Reply | Threaded
Open this post in threaded view
|

Re: Paste database dictionary/creation commands into syntax?

Ruben Geert van den Berg
In reply to this post by Michael Pullmann
Dear Mike,

The respondents in the 2011 data are a different sample than in 2012, right? If so, you'll want to use an "add files" command. However, this can be (very!) tricky since it will apply the dictionary information it first encounters for each variable to this variable in the merged dataset.

So if I have file1 with variable v1 = gender (1= man and 2= woman) and file2 with v1 = income (1=low and 2=high), then

add files file=file1/file=file2.

Will apply the gender dictionary information to v1 even though it has nothing to do with gender for the cases from file2! This is because file1 is specified first on the add variables command. So that's when SPSS encounters dictionary information for v1 which will overwrite the dict info for v1 in file2.

Reversely,

add files file=file2/file=file1.

Will erroneously apply the income dictionary to v1 for cases from file2.

So I guess the problem is not how to apply dictionary info. It is to avoid erroneous dict info to be applied (unless the variable names are not consistent over the two years, in that case the problem is bigger).

I faced this problem some years ago with 12(??) data files. Part of my solution was creating 2 excel sheets, containing only those variables for which either the variable or value labels were not consistent. On visual inspection I (or actually the project manager since I was too lazy) decided for which variables the difference in dict info was (not) acceptable. I created these excel sheets by something like [oms (new data set)]->[display dictionary]->[match files, key=either just variable name or variable name AND value]->[compute flag if not (label1=label2=label3....)]. Not very elegant but way safer/easier than manually copying-pasting.

If you'd like to give this a shot and need help with the syntax, please let us know, we'll be more than happy to assist you!

HTH,

Ruben




Date: Fri, 3 Aug 2012 10:14:41 -0700
From: [hidden email]
Subject: Paste database dictionary/creation commands into syntax?
To: [hidden email]

Hi all,
 
I have an online survey created through Catalyst. It is similar to an online survey we conducted last year. We would like to  merge these files (2011 and 2012).
 
Because it was created through Catalyst, and because we modified some of our survey items, many of the variable attributes are slightly different (variable width, etc). For the merge, these need to match.
 
We would like to paste last year's data attributes as a syntax file so we can easily modify it in order to alter this year's database attributes so the two match, to facilitate the merge. Or perhaps there is some other approach. The goal is to avoid having to re-create the data dictionary from scratch, while ensuring consistency between the datasets. We have added and removed some variables between 2011 and 2012, so I don't think that "apply data dictionary" would not work.
 
Any thoughts on how to approach this issue? I hope I've explained myself well enough.
 

Mike Pullmann
Research Assistant Professor
Division of Public Behavioral Health and Justice Policy
Department of Psychiatry and Behavioral Sciences
University of Washington
2815 Eastlake Ave. East, Suite 200  |  Seattle, WA 98102-3086
UW Box #358015
 
phone: 206.685.0408
fax:  206.685.3430