I need to scan several hundred data files and identify files having string
variables. I have a list of the files already structured as Get File='....' strings. I'm thinking that if there were a way to extract the variable names and their format and then write the file name along with the variable names and format to a spss data file, I could pretty easily identify string format variables. I'm pretty confident that python-based routines would do this but that would have some overhead for me so I'd like to exhaust syntax-based methods first. I know that Display variables will show a variable list with formats and I know that that list can be written to a data file via OMS. I'm doubtful about being able to include the file name. I'm unsure whether the variable list from multiple files can be writtten to a single data file. I'd guess that this isn't so unusual an operation. So, suggestions please. Thanks, Gene Maguin ===================== 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 |
Děkuji za Váš e-mail. Budu si jej však moci přečíst nejdříve 16.5.2011. Poštu nemám přesměrovanou. V případě potřeby kontaktujte prosím Michala Seiferta, [hidden email]. S přátelským pozdravem, Jan Spousta
Thank you for your e-mail. However, I'll be able to read it earliest on 5/16. My e-mail box isn't forwarded. In urgent cases contact please Michal Seifert, [hidden email]. Kind regards, Jan Spousta ===================== 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 Maguin, Eugene
OMS could certainly create a dataset of
the display dictionary output, but you can't get the file name information
that way. You could get an xml or Excel file that contains the file
name and display dictionary information via OMS, but that would require
a good chunk of processing to massage into a useful dataset form.
If "syntax-based methods" includes extension commands, you can almost get there using GATHERMD. That command takes a directory tree and/or wildcard file name specification and produces a dataset listing all the variables in the selected files. The dataset includes the file name, the variable name, and the variable label. It doesn't include the variable type, but you might be able to match this against the OMS-generated dataset. It would be easy to add more dictionary information to the GATHERMD output, too. Using this would require, of course, the Python Essentials and the GATHERMD download from the SPSS Community site. the GATHERMD extension also includes a dialog box interface that appears on the File menu. HTH, Jon Peck Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Gene Maguin <[hidden email]> To: [hidden email] Date: 04/28/2011 09:44 AM Subject: [SPSSX-L] Possibly smple problem Sent by: "SPSSX(r) Discussion" <[hidden email]> I need to scan several hundred data files and identify files having string variables. I have a list of the files already structured as Get File='....' strings. I'm thinking that if there were a way to extract the variable names and their format and then write the file name along with the variable names and format to a spss data file, I could pretty easily identify string format variables. I'm pretty confident that python-based routines would do this but that would have some overhead for me so I'd like to exhaust syntax-based methods first. I know that Display variables will show a variable list with formats and I know that that list can be written to a data file via OMS. I'm doubtful about being able to include the file name. I'm unsure whether the variable list from multiple files can be writtten to a single data file. I'd guess that this isn't so unusual an operation. So, suggestions please. Thanks, Gene Maguin ===================== 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 Maguin, Eugene
Hi Gene, Cheers!!Just in case you change your mind and decide to 'go Python', here's some untested code: import spssaux, glob print "\n".join(set([sav for sav in glob.glob("d:/temp/*.sav") for v in spssaux.VariableDict() if v.variableType > 0])) Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From: Gene Maguin <[hidden email]> To: [hidden email] Sent: Thu, April 28, 2011 5:40:58 PM Subject: [SPSSX-L] Possibly smple problem I need to scan several hundred data files and identify files having string variables. I have a list of the files already structured as Get File='....' strings. I'm thinking that if there were a way to extract the variable names and their format and then write the file name along with the variable names and format to a spss data file, I could pretty easily identify string format variables. I'm pretty confident that python-based routines would do this but that would have some overhead for me so I'd like to exhaust syntax-based methods first. I know that Display variables will show a variable list with formats and I know that that list can be written to a data file via OMS. I'm doubtful about being able to include the file name. I'm unsure whether the variable list from multiple files can be writtten to a single data file. I'd guess that this isn't so unusual an operation. So, suggestions please. Thanks, Gene Maguin ===================== 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 |
Hi,
I am no longer with UCLA Extension. Please contact Lisa Juarez ([hidden email]).
Thank you.
Joanne Han
Marketing Research Manager
UCLA Extension |
Free forum by Nabble | Edit this page |