|
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:
-- 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 |
[Prev in Thread] | Current Thread | [Next in Thread] |