I have hundreds of SPSS .sav files. For each one I want to extract the variable NAMES and variable LABELS as a two column table to a csv file. I know that this is straightforward by simply copying and pasting from the "Variable view" window, but I would really like to know how to do this using syntax. Is this possible?
Many thanks in advance for any help!
You might be interested in the GATHERMD extension command, It takes a wildcard for the file names and builds a dataset with three variables: the file name, the variable name, and the variable label. You could then just save that as a csv file.
This command requires the Python Essentials available with your Statistics installation or via the SPSS Community website (www.ibm.com/developerworks/spssdevcentral).
Using native Statistics syntax, DISPLAY DICTIONARY and CODEBOOK might be helpful, but they won't give you all this information in one table.
Related
My company is using BI Publisher for some data dumps and I know BI Publisher isn't really designed for that, but this is what I have to use.
I have two files with over 100 fields each. Is there a way to add every field to the report or do I have to add each field individually?
If you have an data model export, you could use the BIP designer in word to add a table, and select multiple fields to the output. The wizard will do the xdo code for you.
Use E-Text output. It is designed for EFT (Electronic Fund Transfers) in Payment module. But you can use it to export a CSV (Comma Separated Value) file, or a fixed width file. Both of which can be opened in Excel. The E-Text output is fully documented in the BI Publisher user guides. Some advanced stuff is a bit harder to accomplish, but it is not terribly difficult. A simple CSV file should be quick and easy to create. You will need to list every field, there's no "give me everything" command.
It's actually to your benefit to use those for larger data extracts, when you you use the Word RTF tables, the output Excel files are VERY large due to the way BI Publisher formats the cells.
Let me start by saying that I know too little about coding etc to translate some of the solutions given on this platform to solve my issue. So hopefully someone can help me get started..
I am trying to combine a certain section of multiple google spreadsheet files with multiple tabs into one file. The name and number of the various tabs are different (and change over time).
To explain. We have for various person an overview of their projects (each project on its own tab). Each project/tab contains a number of to do's. What I need to achieve is to import al the to do's to a master list so that we have 1 master overview (basically a big to do list that I can sort on date).
Two exmples with dummy information. The relevant information starts on line 79
https://docs.google.com/spreadsheets/d/1FsQd9sKaAG7hKynVIR3sxqx6_yR2_hCMQWAWsOr4tj0/edit?usp=sharing
https://docs.google.com/spreadsheets/d/155J24uQpRC7uGvZEhQdkiSBnYU28iodAn-zR7rUhg1o/edit?usp=sharing
Since this information is dynamic and you are restricted from using app script, you can create a "definitions" or "parameters" sheet where the person must either report the NAMES of their projects and the ROW the tasks starts on and total length. From there you can use importrange function to get their definitions. From the definitions you can use other import range functions to get their tasks list. Concatenating it is gonna be a pretty big issue for you though.
This unfortunately would be much easier for you to accomplish with a different architecture to your docs / sheets. The more a spreadsheet looks like a database (column heads and rows of data that match those headers), the easier they are to work with. The more they look like forms / paper worksheets the more code you would need to parse that format.
I've got an absolutely horrible dataset in Excel (13,500 variables, a lot of them irrelevant to my purposes). I need to analyse in SPSS as I have a lot of data transformations to do... but SPSS 24 struggles with a dataset that size. Well... either SPSS struggles, or my work PC does.
Is there a way, when importing data from Excel, to import multiple ranges? Specifically, I want Column A (my unique identifier), then several other ranges (e.g. G:AC, DD:JJ, etc.).
/CELLRANGE=RANGE only seems to allow a single range.
If you have the appropriate ODBC driver for Excel, you can use the database reading facility in Statistics to select the fields. However, the catch with ODBC and Office is that the bigness has to match. If both are 32-bit, that's easy, but 64-bit Statistics would need 64-bit Office, and that's a world of hurt.
No (you can't specify multiple ranges), is the short answer. What you ought to be doing is importing the entire relevant range and then using SPSS commands to manipulate as you desire. For example using ADD FILES FILE with DROP sub command to delete irrelevant columns/variables.
I don't know of a way to directly import multiple ranges from Excel. You might try importing the file to an MS Access database first, then read the table from the database to SPSS using (in SPSS) "open database" --> "new query". The query editor will let you specify the fields you want to import.
I was wondering if gephi supports importing a cluster file that has the community assignment of each node in a graph on a separate line (similar to the Pajek .clu format)? I am looking for a way to color the nodes belonging to the same community. In igraph (for R), I can import this file and set the vertex color attributes based on it. Was wondering if gephi had a similar feature?
I saw this answer here from over 5 years ago saying that it wasn't possible, was wondering if that had changed now?
Thanks!
The .clu file contains one line per node with the cluster number at least the example I see here. Gephi cannot import it directly but you can trick it to obtain the same result. Here are the steps I propose:
Import your .net file with Gephi
Go to Data Laboratory and sort your nodes according to the Id column, by clicking on the column name
Create a new column called Cluster by pressing Add column the bottom of the screen. The default String type will do
Click Export table, select only the fields Id and Cluster, and export the file somewhere
Open the CSV file with e.g. Excel or LibreOffice
Open your .clu file with a text editor, even Notepad will do
Copy all the numbers in the file and paste them in the Cluster column of your CSV. Save your CSV
Import the CSV back into Gephi, by clicking Import Spreadsheet and press ok through the next steps.
At the end you should see your Cluster values having the same values as in the .clu file!
Make sure that the same field delimiter is used throughout in steps 4. and 8. I would suggest to use ; as Excel directly understands it.
You are welcome to report back if you are still having problems
I want to put different custom tables to different sheets in Excel. I tried with OMS and OUTPUT EXPORT but that functions not do what I want. If somebody have idea I hope that will help me. :)
OUTPUT EXPORT has an OPERATION subcommand with options CREATEFILE / CREATESHEET / MODIFYSHEET from which you can route CTABLES to desired sheets in a target/new Excel file.
You'll need to organise your OUTPUT documents as you wish your sheets.
Exorting to Excel using OMS you can not route to a specific sheet only with OUTPUT EXPORT you can.
OUTPUT EXPORT can write different sheets, but it doesn't give you much flexibiity in the objects that get exported when using it via syntax. The syntax mode assumes that you are not going to be interactively selecting the tables.
However, the SPSSINC OUTPUT MODIFY extension command includes a customoutputfunctions.py module that has an excelexport function that will do what you want. Here is an example. For more information see the SPSSINC OUTPUT MODIFY documentation or the dialog (on Utilities once installed). Then look at the examples in the customoutputfunctions.py module.
SPSSINC MODIFY OUTPUT TABLES
/IF SUBTYPE="'Custom Table'" PROCESS=ALL
/CUSTOM FUNCTION="customoutputfunctions.excelexport(file='c:/temp/extest.xls',
sheet='table#',action='CreateWorksheet')".