|
On Mon, 28 Jan 2008 12:37:15 -0800, Schrock, Daryl <[hidden email]>
wrote: >Hi all, > > > >Ok; I was able to make Ray's syntax work by using add files on all of >the results_1 ...results_126 files and merging them into one file >(c:temp\results) and then proceeding with the syntax from Ray's site. >Not an elegant solution, but it works. (Just a note, the matching syntax >that I modified actually returned 127 results files; each one containing >one case, except for results_127 which was empty [did not contain any >data]) > > > >But, I'm left with the question of why the original syntax didn't merge >all of these cases into one results file when using my data, when it >worked as expected when using Ray's sample data. Does anyone have any >thoughts on this? > > > >Daryl > > > >====================To manage your subscription to SPSSX-L, send a >[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 I just had this problem with propensity matching using the same macro from spsstools. I have 866 cases in my treatment group and SPSS created over 866 seperate files. The issue does seem to be coming from "!match nbtreat=866." I got an error message (or 866 of them) stating that the results file was in use so the data were being saved to a seperate file. Could this be a glitch with SPSS 17 (I think the macro was written for SPSS 11.5)? Has anyone else encountered this and, if so, any solutions? My syntax is below but I don't think that is where the problem is. Thanks, Dan SORT CASES BY treatm(D) propen. COMPUTE idx=$CASENUM. SAVE OUTFILE='C:\Documents and Settings\riner\My Documents\prop\mydata.sav'. * Erase the previous temporary result file, if any. ERASE FILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. COMPUTE key=1. SELECT IF (1=0). * Create an empty data file to receive results. SAVE OUTFILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. ********************************************. * Define a macro which will do the job. ********************************************. SET MPRINT=no. *////////////////////////////////. DEFINE !match (nbtreat=!TOKENS(1)) !DO !cnt=1 !TO !nbtreat GET FILE='C:\Documents and Settings\riner\My Documents\prop\mydata.sav'. SELECT IF idx=!cnt OR treatm=0. DO IF $CASENUM=1. COMPUTE #target=propen. ELSE. COMPUTE delta=propen-#target. END IF. EXECUTE. SELECT IF ~MISSING(delta). IF (delta<0) delta=-delta. SORT CASES BY delta. SELECT IF $CASENUM=1. COMPUTE key=!cnt. ADD FILES FILE=* /FILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. SAVE OUTFILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. !DOEND !ENDDEFINE. *////////////////////////////////. SET MPRINT=yes. **************************. * Call macro (we know that there are 7 treatment cases). **************************. !match nbtreat=866. * Sort results file to allow matching. GET FILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. SORT CASES BY key. SAVE OUTFILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. * Match each treatment cases with the most similar non treatment case. GET FILE='C:\Documents and Settings\riner\My Documents\prop\mydata.sav'. MATCH FILES /FILE=* /FILE='C:\Documents and Settings\riner\My Documents\prop\results.sav' /RENAME (idx = d0) caseid=caseid2 cum_aqpr_4c=cum_aqpr_4c2 propen=propen2 treatm=treatm2 key=idx /BY idx /DROP= d0. EXECUTE. ===================== 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 |
|
All,
I've identified an issue in exporting to excel or access. I very often restructure data from cases to variables. This results in variables such as var.1, var.2 etc. The '.' doesn't work for excel or access because it has a special meaning for them. Unless I'm missing something it would seem that SPSS/PAWS should include an option in restructuring, or perhaps a default, to use the '_' underscore instead of the '.'. My2cents, matt Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 568-5648 ===================== 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 |
|
Matt,
casestovars uses "." by default but does offer the option to select a different separator, or none, via the /separator subcommand, e.g., /separator = '_' Dan R Pirritano, Matthew wrote: > All, > > I've identified an issue in exporting to excel or access. I very often > restructure data from cases to variables. This results in variables such > as var.1, var.2 etc. The '.' doesn't work for excel or access because > it has a special meaning for them. Unless I'm missing something it would > seem that SPSS/PAWS should include an option in restructuring, or > perhaps a default, to use the '_' underscore instead of the '.'. > > My2cents, > > matt > > Matthew Pirritano, Ph.D. > Research Analyst IV > Medical Services Initiative (MSI) > Orange County Health Care Agency > (714) 568-5648 > > ===================== > 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 > > -- Daniel Robertson Senior Research and Planning Associate Institutional Research and Planning Cornell University / irp.cornell.edu ===================== 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 |
|
Thanks! I should have checked the manual. I always restructure point and
click. Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 568-5648 -----Original Message----- From: Daniel Robertson [mailto:[hidden email]] Sent: Thursday, October 01, 2009 10:00 AM To: Pirritano, Matthew Cc: [hidden email] Subject: Re: [SPSSX-L] Issue Exporting to Excel or Access Matt, casestovars uses "." by default but does offer the option to select a different separator, or none, via the /separator subcommand, e.g., /separator = '_' Dan R Pirritano, Matthew wrote: > All, > > I've identified an issue in exporting to excel or access. I very often > restructure data from cases to variables. This results in variables such > as var.1, var.2 etc. The '.' doesn't work for excel or access because > it has a special meaning for them. Unless I'm missing something it would > seem that SPSS/PAWS should include an option in restructuring, or > perhaps a default, to use the '_' underscore instead of the '.'. > > My2cents, > > matt > > Matthew Pirritano, Ph.D. > Research Analyst IV > Medical Services Initiative (MSI) > Orange County Health Care Agency > (714) 568-5648 > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > > -- Daniel Robertson Senior Research and Planning Associate Institutional Research and Planning Cornell University / irp.cornell.edu ===================== 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 |
|
In reply to this post by Dan Riner
I wrote a macro very similiar to this several years ago, and it was for SPSS v11.*. Most importantly it was written before the ability to open multiple data files was implemented. Albeit I only use it about once a year (usually when someone emails me about this very problem) it has been a tricky problem to resolve. Quite frankly sometimes it works and sometimes it doesn't. My advice is to use R for propensity matching, or SAS.
The learning curve on R is long and steep, but worth the time.
Good luck,
John
From: Dan Riner <[hidden email]> To: [hidden email] Sent: Thursday, October 1, 2009 10:47:24 AM Subject: Re: Matching cases on basis of Propensity Scores On Mon, 28 Jan 2008 12:37:15 -0800, Schrock, Daryl <[hidden email]> wrote: >Hi all, > > > >Ok; I was able to make Ray's syntax work by using add files on all of >the results_1 ...results_126 files and merging them into one file >(c:temp\results) and then proceeding with the syntax from Ray's site. >Not an elegant solution, but it works. (Just a note, the matching syntax >that I modified actually returned 127 results files; each one containing >one case, except for results_127 which was empty [did not contain any >data]) > > > >But, I'm left with the question of why the original syntax didn't merge >all of these cases into one results file when using my data, when it >worked as expected when using Ray's sample data. Does anyone have any >thoughts on this? > > > >Daryl > > > >====================To manage your subscription to SPSSX-L, send a >[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 I just had this problem with propensity matching using the same macro from spsstools. I have 866 cases in my treatment group and SPSS created over 866 seperate files. The issue does seem to be coming from "!match nbtreat=866." I got an error message (or 866 of them) stating that the results file was in use so the data were being saved to a seperate file. Could this be a glitch with SPSS 17 (I think the macro was written for SPSS 11.5)? Has anyone else encountered this and, if so, any solutions? My syntax is below but I don't think that is where the problem is. Thanks, Dan SORT CASES BY treatm(D) propen. COMPUTE idx=$CASENUM. SAVE OUTFILE='C:\Documents and Settings\riner\My Documents\prop\mydata.sav'. * Erase the previous temporary result file, if any. ERASE FILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. COMPUTE key=1. SELECT IF (1=0). * Create an empty data file to receive results. SAVE OUTFILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. ********************************************. * Define a macro which will do the job. ********************************************. SET MPRINT=no. *////////////////////////////////. DEFINE !match (nbtreat=!TOKENS(1)) !DO !cnt=1 !TO !nbtreat GET FILE='C:\Documents and Settings\riner\My Documents\prop\mydata.sav'. SELECT IF idx=!cnt OR treatm=0. DO IF $CASENUM=1. COMPUTE #target=propen. ELSE. COMPUTE delta=propen-#target. END IF. EXECUTE. SELECT IF ~MISSING(delta). IF (delta<0) delta=-delta. SORT CASES BY delta. SELECT IF $CASENUM=1. COMPUTE key=!cnt. ADD FILES FILE=* /FILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. SAVE OUTFILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. !DOEND !ENDDEFINE. *////////////////////////////////. SET MPRINT=yes. **************************. * Call macro (we know that there are 7 treatment cases). **************************. !match nbtreat=866. * Sort results file to allow matching. GET FILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. SORT CASES BY key. SAVE OUTFILE='C:\Documents and Settings\riner\My Documents\prop\results.sav'. * Match each treatment cases with the most similar non treatment case. GET FILE='C:\Documents and Settings\riner\My Documents\prop\mydata.sav'. MATCH FILES /FILE=* /FILE='C:\Documents and Settings\riner\My Documents\prop\results.sav' /RENAME (idx = d0) caseid=caseid2 cum_aqpr_4c=cum_aqpr_4c2 propen=propen2 treatm=treatm2 key=idx /BY idx /DROP= d0. EXECUTE. ===================== 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 |
| Free forum by Nabble | Edit this page |
