pspp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use MATCH FILES--Simple Example Needed


From: Alan Mead
Subject: Re: How to use MATCH FILES--Simple Example Needed
Date: Fri, 22 Feb 2019 17:39:22 -0600
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

See: https://www.google.com/search?q=spss+syntax+match+files&oq=spss+syntax+match+files

From memory:

match files file = 'one.sav'
  /file = 'two.sav'
  /by patient_id
  /map .
execute.

/MAP will show you a "map"  of the matched variables (and is optional)... The matched file will have all the cases and variables in both files. If a case doesn't match, it will appear in the matched file but be "half" missing. BTW, if patient_ID is a string, it needs to be the same size in both files. It's usually better to use numeric matching variables.

But I think this will fail (with spss, haven't tried pspp in a while) unless both files are sorted by patient_id and there are no duplicate patient ID's, so:

get /file = 'one.sav'.
sort cases by patient_id.
compute dup=0.
execute.
compute dup=lag(dup)+1.
freq / dup.
temporary.
select if dup > 0.
print / patient_id.
execute.

* resolve dups if you can...
* syntax below deletes duplicates...
select if dup=0.
save /outfile = 'sorted_deduped_one.sav'.

Do the above with two.sav and then match the sorted, de-duped files.

-Alan



On 2/22/2019 5:11 PM, mag wrote:
Hi List Members.  I am having trouble understanding the syntax for MATCHING files as shown in the manual.  I'll make this simple because I think I just need the basics--no renaming, or dropped variables.   Let's say I want to match data set ONE.sav and data set TWO.sav, by the variable PATIENT_ID.  All variables are numeric.  How would I do this? Please use the actual data set names (i.e., ONE.sav and TWO.sav) to make this as concrete as possible. 
One.sav variables = PATIENT_ID, Condition, Period.
Two.sav variables = PATIENT_ID,  TestScore1, Testscore2
Thank you very much for your help!

_______________________________________________
Pspp-users mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/pspp-users

-- 

Alan D. Mead, Ph.D.
President, Talent Algorithms Inc.

science + technology = better workers

http://www.alanmead.org

"You're an interesting species. An interesting mix. 
You're capable of such beautiful dreams, and such 
horrible nightmares. You feel so lost, so cut off, 
so alone, only you're not. See, in all our 
searching, the only thing we've found that makes 
the emptiness bearable, is each other."

-- Carl Sagan, Contact

reply via email to

[Prev in Thread] Current Thread [Next in Thread]