Text based merging in SPSS

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

Text based merging in SPSS

jagadishpchary
Hi:

I am doing some R&D on merging the SPSS files - which are from different sources (though have the same variable names but have different codes for value labels). Hence I want to know, is there any way where we can do the merging based on the value labels text but not on code based. Also, would appreciate if any one has the solution using the python code.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Text based merging in SPSS

John F Hall

Check out ADD FILES in the manual.  How many variables are there in each file?  If there aren’t too many, a quick, if inelegant, solution would be:

 

(Untested)

Open file1                                         [dataset1]

Open file2                                         [daraset2]

Data >> Copy Dataset                    [dataset3, probably called  Untitled2        

File >> New >> Syntax

*change the names of the variables in dataset3.

rename variables (<varlist from file 2> = <v1 to vn>).

add files  file dataset1 /file *.

File >> Save As  <new filename>

 

File ready to explore.  You’ll get Python type solutions from other listers. 

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email] 

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

 

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of jagadishpchary
Sent: 31 October 2016 07:31
To: [hidden email]
Subject: Text based merging in SPSS

 

Hi:

 

I am doing some R&D on merging the SPSS files - which are from different sources (though have the same variable names but have different codes for value labels). Hence I want to know, is there any way where we can do the merging based on the value labels text but not on code based. Also, would appreciate if any one has the solution using the python code.

 

Thanks.

 

 

 

--

View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Text-based-merging-in-SPSS-tp5733413.html

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

 

=====================

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
Reply | Threaded
Open this post in threaded view
|

Re: Text based merging in SPSS

Art Kendall
In reply to this post by jagadishpchary
I am not sure I completely understand what you would like to do but possibly creating new variables that contain the value labels as string variables would help.

VALUELABEL function

VALUELABEL. VALUELABEL(varname). String. Returns the value label for the value of variable or an empty string if there is no label for the value. The value of varname must be a variable name; it cannot be an expression.

Example

STRING labelvar (A120).
COMPUTE labelvar=VALUELABEL(var1).
DO REPEAT varlist=var2, var3, var4
         /newvars=labelvar2, labelvar3, labelvar4.
- STRING newvars(A120).
- COMPUTE newvars=VALUELABEL(varlist).
END REPEAT.

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Text based merging in SPSS

David Marso
Administrator
In reply to this post by jagadishpchary

Please post an example of before/after.
"is there any way where we can do the merging based on the value labels text but not on code based."
It is too early in the morning for me to parse this.
-------

jagadishpchary wrote
Hi:

I am doing some R&D on merging the SPSS files - which are from different sources (though have the same variable names but have different codes for value labels). Hence I want to know, is there any way where we can do the merging based on the value labels text but not on code based. Also, would appreciate if any one has the solution using the python code.

Thanks.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"