Hello Dear all,
I wonder if you know how I can create a table including different variable form different data file. For example: sex1 sex2 sex3 (Which sex1 belong to datafile1,sex2:datafile2 and so on) count1 count2 count3 I need to have these comparison within spss and after that export to Excel ..At the end I want to have ghraph in powerpoint.I am trying to automate this process but first I think I need to have my required varaible in spss. I appreciate if you can help me to solve this. Best Regards, Behnaz Shirazi _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/ |
If all you want is the ID Sex1 Sex2 Sex3 etc. and dataset1-3 etc.
contain more items, you can use Match files. In the syntax below you will need to either replace dataset1 (etc.) with the full path/filename in quotes OR open the file and name it dataset1 (etc.) perhaps using something like (untested) GET FILE='C:\SPSSfiles\dataset1.sav'/keep=ID sex1. DATASET NAME=dataset1 ***repeat for each dataset. Match files file=dataset1/ file=dataset2/ file=dataset3/ (etc.) keep=ID sex1 sex2 sex3 (etc.). If you have used the GET FILE.../KEEP command above, you will NOT need the keep statement on the Match files command. Melissa The bubbling brook would lose its song if you removed the rocks. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of behnaz shirazi Sent: Tuesday, February 06, 2007 10:19 AM To: [hidden email] Subject: [SPSSX-L] comparing multiple data set Hello Dear all, I wonder if you know how I can create a table including different variable form different data file. For example: sex1 sex2 sex3 (Which sex1 belong to datafile1,sex2:datafile2 and so on) count1 count2 count3 I need to have these comparison within spss and after that export to Excel ..At the end I want to have ghraph in powerpoint.I am trying to automate this process but first I think I need to have my required varaible in spss. I appreciate if you can help me to solve this. Best Regards, Behnaz Shirazi _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/ PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. |
In reply to this post by behnaz shirazi-2
Hi Behnaz,
This entire process can be automated in python, if you have the programmability installed, and then you would also need to download the win32com module. Your code would look something like... (untested) You probably need to say what comparisons you are trying to achieve as to what test you want to run begin program. import SPSS, spssaux, win32com.client, viewer file_match = ('''MATCH FILES FILE='c:\temp\datafile1.sav' /TABLE='c:\temp\ datafile2.sav' /BY=SEX. EXECUTE.''') #Personally I think you probably need to add the data as cases and have a handle from what file it is from in order to do some analysis file_Tables = ('''Your Tables command here''') spss.Submit(file_match) spss.Submit(file_Tables) ## We now clean up the viewer to remove logs notes etc in order to export only the table spssappObj = viewer.spssapp() outputdoc = spssappObj.GetDesignatedOutput() objItems = outputdoc.Items outputdoc.ClearSelection() for i in range(objItems.Count): objItem = objItems.GetItem(i) intSPSSType = objItem.SPSSType if (intSPSSType == 4 or intSPSSType == 9 or intSPSSType == 3 or intSPSSType == 8 or intSPSSType == 7): objItem.Selected = True outputdoc.Remove() file_export = spssappObj.ExportDesignatedOutput('where you want to you're your excel file.xls' ,visibleContents=False, format="Excel", graphics=True) ##We now open your excel file and and generic powerpoint presentation xl = win32com.client.Dispatch("Excel.Application") ppt = win32com.client.Dispatch("PowerPoint.Application") ppt.Visible = 1 #open MS Powerpoint xl.Visible = 1 #open MS Excel xl.Workbooks.Open('your exported excel file.xls') ### next a saved XLA VBA Macro doing what your chart you want to make ### you will have to make this xl.Workbooks.Open('wherever your macro is saved.xla') ### now load a presentation ppt.Presentations.Open('any base presentation.ppt') ## call the worksheet you want to work on xl.Application.Workbooks("working_output").Activate ##then finally call your macro to run xl.Application.Run("VBA macro name.xla!Sheet1.VBA macro name") end program. The last parts are in VBA and for that final part you may want to go to VBA list in order to create the code for your macro I hope this gives you an idea of where you can go Mike -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of behnaz shirazi Sent: 06 February 2007 16:19 To: [hidden email] Subject: comparing multiple data set Hello Dear all, I wonder if you know how I can create a table including different variable form different data file. For example: sex1 sex2 sex3 (Which sex1 belong to datafile1,sex2:datafile2 and so on) count1 count2 count3 I need to have these comparison within spss and after that export to Excel ..At the end I want to have ghraph in powerpoint.I am trying to automate this process but first I think I need to have my required varaible in spss. I appreciate if you can help me to solve this. Best Regards, Behnaz Shirazi _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/ ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Free forum by Nabble | Edit this page |