Sorry, for opening a new thread, but the list is quite slow with
publishing my last post. I found out the NEW FILE is the way to delete all variables. But it creates a unnamed new dataset which is not refered to any sav-file. So I have to tell that SPSS, too. But this doesn't work. [output] DATASET ACTIVATE DataSet2. NEW FILE DATASET NAME Test WINDOW=FRONT. SAVE OUTFILE='C:\Users\vuser\vbox_share\Test.sav' >Error # 105. Command name: SAVE >This command is not valid before a working file has been defined. >Execution of this command stops. /COMPRESSED. [/output] How can I handle this? It is quite hard to come behind the SPSS-concepts. -- <http://dontbubble.us/> ===================== 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 |
Administrator
|
I think you need to back up a bit and explain exactly what you are trying to do (and why).
It sounds like you want to save an empty SPSS data file. Why? You can save a file with no data in it, but IIRC, it has to have at least one variable. E.g., * Untested -- no SPSS on this machine. DATA LIST list / @junk@ . BEGIN DATA . END DATA. SAVE OUTFILE='C:\Users\vuser\vbox_share\Test.sav'
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
On 2014-03-22 04:34 Bruce Weaver <[hidden email]> wrote:
> I think you need to back up a bit and explain exactly what you are > trying to do (and why). I want to create all my variables (not the data) by script. To build this script I have to run it a lot of times for testing it. To prevend errors of multiple variable definitions I need to kill all variables at the beginning of the script. "tabula rasa" Really simple would be DELETE VARIABLES ALL. But this is not allowed. Don't understand why. A NEW FILE should be used. But this create a new dataset, new file, etc. I don't want a new dataset (sav-file). I just want to use the same sav-file all the time. Because I have to use NEW FILE to delete all variables "in" the sav-file, I thought it would be a good idea to overwrite the old sav-file with the NEW-FILE-one. btw: SAVE OUTFILE doesn't overwrite anything. And in the ref of SAVE I can see there is no switch for it - if I am right. ===================== 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 |
You might want to look into INPUT PROGRAM.
Input programs create new datasets from scratch.
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Moon Kid <[hidden email]> To: [hidden email], Date: 03/22/2014 06:06 AM Subject: Re: [SPSSX-L] NEW FILE & SAVE Sent by: "SPSSX(r) Discussion" <[hidden email]> On 2014-03-22 04:34 Bruce Weaver <[hidden email]> wrote: > I think you need to back up a bit and explain exactly what you are > trying to do (and why). I want to create all my variables (not the data) by script. To build this script I have to run it a lot of times for testing it. To prevend errors of multiple variable definitions I need to kill all variables at the beginning of the script. "tabula rasa" Really simple would be DELETE VARIABLES ALL. But this is not allowed. Don't understand why. A NEW FILE should be used. But this create a new dataset, new file, etc. I don't want a new dataset (sav-file). I just want to use the same sav-file all the time. Because I have to use NEW FILE to delete all variables "in" the sav-file, I thought it would be a good idea to overwrite the old sav-file with the NEW-FILE-one. btw: SAVE OUTFILE doesn't overwrite anything. And in the ref of SAVE I can see there is no switch for it - if I am right. ===================== 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 Moon Kid
When you say "script"
do you mean a file of SPSS syntax?
Why do you think there would be multiple definitions? Please clarify are you renaming variables? changing variable labels? value labels, missing values? formats? Art Kendall Social Research Consultants On 3/22/2014 8:14 AM, Moon Kid [via SPSSX Discussion] wrote: On 2014-03-22 04:34 Bruce Weaver <[hidden email]> wrote:
Art Kendall
Social Research Consultants |
btw: Why are in most of posts here the reply-To-field is set to a
private adresse? It is against all rules of a mailing-list. And why can I see my own posts on the list? On 2014-03-22 05:38 Art Kendall <[hidden email]> wrote: > When you say "script" > do you mean a file of SPSS syntax? Yeah, by the way I don't understand the difference in SPSS between script and syntax. These words are fine and concrete defined. But I think SPSS missinterpret them. A "Script" is a text-based file with code in it. And this code (text) have to fit to a defined syntax to be interpreted by a interpreter-engine. Thats all. So where is the difference between this two subjects in SPSS? > Why do you think there would be multiple definitions? When I run a script/syntax with "STRING v01 (A1)." two times there would be an error. That is why I need to delete all variables at the beginning of the script. > Please clarify are you renaming variables? STRINGs and NUMERICs. > changing variable labels? value labels, missing values? > formats? I change a lot of them. I want to build my variables with all specifications from scratch. -- <http://dontbubble.us/> ===================== 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 |
SPSS uses the script and syntax terms in
a way that might not fit your preconceptions.
Syntax refers to the traditional syntax language as defined in the Command Syntax Reference. It mainly cover backend functionality. SPSS also supports programs written in Python, R, or Java that use apis provided by various plugins. The term scripting is generally used to refer to mainly frontend functionality written using Python scripting or Basic (a VBA dialect). As for list settings, you can control some of these from the UGA home of the list. Others, which have been endlessly debated on this list, are controlled by the list admin. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Moon Kid <[hidden email]> To: [hidden email], Date: 03/22/2014 07:46 AM Subject: Re: [SPSSX-L] NEW FILE & SAVE Sent by: "SPSSX(r) Discussion" <[hidden email]> btw: Why are in most of posts here the reply-To-field is set to a private adresse? It is against all rules of a mailing-list. And why can I see my own posts on the list? On 2014-03-22 05:38 Art Kendall <[hidden email]> wrote: > When you say "script" > do you mean a file of SPSS syntax? Yeah, by the way I don't understand the difference in SPSS between script and syntax. These words are fine and concrete defined. But I think SPSS missinterpret them. A "Script" is a text-based file with code in it. And this code (text) have to fit to a defined syntax to be interpreted by a interpreter-engine. Thats all. So where is the difference between this two subjects in SPSS? > Why do you think there would be multiple definitions? When I run a script/syntax with "STRING v01 (A1)." two times there would be an error. That is why I need to delete all variables at the beginning of the script. > Please clarify are you renaming variables? STRINGs and NUMERICs. > changing variable labels? value labels, missing values? > formats? I change a lot of them. I want to build my variables with all specifications from scratch. -- <http://dontbubble.us/> ===================== 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 Moon Kid
At 06:29 AM 3/22/2014, Moon Kid wrote:
>I found out the NEW FILE is the way to delete all variables. But it >creates a unnamed new dataset which is not refered to any sav-file. >So I have to tell that SPSS, too. An important distinction: NEW FILE doesn't delete all variables; it gives you a new active file, in which there are no variables currently defined. You've already noticed that, if the active file had a dataset name, it continues in existence under that name, when you create a new active file. You've probably noticed that each SPSS file has its own name space; once you've opened a new file, you can define variables as you please, regardless of their existence or datatypes in any other file. Of course, if you're going to merge or join files, you have to use variable names that won't conflict. Oh -- you mentioned being glad there's a time format. SPSS uses an epoch-and-offset representation of dates; date-times are in seconds, with the midnight that begins October 14, 1582 counting as day 1, i.e. numerical value 86,400. There's a section "Date and Time" in the Command Syntax Reference chapter "Universals", giving what functions and formats are available. (Alas, there's no syntax for writing a true date constant. Instead of '04-Jul-1776'D, or some such, you have to write 'DATE.DMY(4,7,1776)'.) Finally, the Command Syntax Reference article on the FORMATS command has a table of available formats; in at least some editions, I've found it more complete and helpful than the table in the Universals chapter. ===================== 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 |