|
Dear all,
I know there's spssaux.GetActiveDatasetName() but can Python also render a list of ALL open datasets? TIA! Ruben van den Berg Consultant Models & Methods TNS NIPO Email: [hidden email] Mobiel: +31 6 24641435 Telefoon: +31 20 522 5738 Internet: www.tns-nipo.com |
|
Jon Peck SPSS, an IBM Company [hidden email] 312-651-3435
Dear all, I know there's spssaux.GetActiveDatasetName() but can Python also render a list of ALL open datasets? begin program. import SpssClient SpssClient.StartClient() ddlist = SpssClient.GetDataDocuments() for i in range(ddlist.Size()): dd = ddlist.GetItemAt(i) ddname = dd.GetDatasetName() ddpath = dd.GetDocumentPath() print ddname, ddpath SpssClient.StopClient() end program. TIA! Ruben van den Berg Consultant Models & Methods TNS NIPO Email: [hidden email] Mobiel: +31 6 24641435 Telefoon: +31 20 522 5738 Internet: www.tns-nipo.com |
|
Dear Jon,
Thanks a lot once again! In the unlikely case anyone else would ever like to use this, I'll paste my modified test code below. Best regards, Ruben van den Berg Consultant Models & Methods TNS NIPO Email: [hidden email] Mobiel: +31 6 24641435 Telefoon: +31 20 522 5738 Internet: www.tns-nipo.com *Generate 5 random open datasets. dataset close all. begin program. import random,spss for i in random.sample(range(1,11),5): spss.Submit(""" data list free/id. begin data %d end data. dataset name d%d. """%(i,i)) end program. *Define function. begin program. def opendatasets(): """ This function will render a list of all open datasets. """ import SpssClient datasets=[] SpssClient.StartClient() ddlist = SpssClient.GetDataDocuments() for i in range(ddlist.Size()): dd = ddlist.GetItemAt(i) ddname = dd.GetDatasetName() ddpath = dd.GetDocumentPath() datasets.append(ddname) SpssClient.StopClient() return datasets end program. *Call and test function. begin program. datasets= opendatasets() print datasets print 'd1' in datasets end program. *Happy end. Date: Thu, 19 Aug 2010 07:33:51 -0600 From: [hidden email] Subject: Re: Can Python render a list of all open datasets? To: [hidden email] Jon Peck SPSS, an IBM Company [hidden email] 312-651-3435
Dear all, I know there's spssaux.GetActiveDatasetName() but can Python also render a list of ALL open datasets? begin program. import SpssClient SpssClient.StartClient() ddlist = SpssClient.GetDataDocuments() for i in range(ddlist.Size()): dd = ddlist.GetItemAt(i) ddname = dd.GetDatasetName() ddpath = dd.GetDocumentPath() print ddname, ddpath SpssClient.StopClient() end program. TIA! Ruben van den Berg Consultant Models & Methods TNS NIPO Email: [hidden email] Mobiel: +31 6 24641435 Telefoon: +31 20 522 5738 Internet: www.tns-nipo.com |
|
Hello,
Thank you for your email. I will be out of the office beginning Friday, August 20th, returning on Tuesday, August 24th and will respond to my message when i return. Thanks! Genevieve Odoom Policy and Program Analyst OANHSS Suite 700 - 7050 Weston Rd. Woodbridge, ON L4L 8G7 Tel: (905) 851-8821 x 241 Fax: (905) 851-0744 [hidden email] www.oanhss.org<https://mail.oanhss.org/ecp/Organize/www.oanhss.org> ===================== 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 |
