Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Keep Subcommand not working....

164 views
Skip to first unread message

meb...@gmail.com

unread,
Mar 15, 2006, 4:40:49 PM3/15/06
to
Hello all, I'm relatively new to SPSS syntax, I've been teaching myself
based off posts from this group and some computer programming skills
i've picked up... anywho..
I transfered some syntax from SPSS 8.0 to SPSS 11.0 (and i included the
data file too ;-)) below is the syntax

get file='C:\Documents and Settings\psyc-ga\Desktop\SPSS
Syntax\test3.sav'.
/KEEP
id# Clinid# Case# TSERVHR TXLENGTH TXDOSE CTNSWTM CTNSWIND
THNSWTM THNSWING CTCANTM CTCANIND THCANTM THCANIND UNCONTM
UNCONND.

SAVE OUTFILE='C:\Documents and
Settings\asburkley0\Desktop\Util_tab1.sav'
/COMPRESSED.

however when I ran the syntax in SPSS 11.0 the output stated

>Error # 1. Command name: /KEEP
>The first word in the line is not recognized as an SPSS command.
>This command not executed.

So WTF? lol I thought KEEP was a subcommand in SPSS 11.0 too?? (btw
the data has over 1000 variables so it'd be nice to sort out the ones i
want) THANKS A BUNCH!

~D.B.

war...@odjfs.state.oh.us

unread,
Mar 15, 2006, 4:48:07 PM3/15/06
to
Hi,
Try this:

get file='C:\Documents and Settings\psyc-ga\Desktop\SPSS

Syntax\test3.sav' /KEEP


id# Clinid# Case# TSERVHR TXLENGTH TXDOSE CTNSWTM CTNSWIND
THNSWTM THNSWING CTCANTM CTCANIND THCANTM THCANIND UNCONTM
UNCONND.

The trick is to remove the period after test3.sav'. KEEP is a
subcommand.

meb...@gmail.com

unread,
Mar 15, 2006, 4:54:08 PM3/15/06
to
DAH! Such a Simple Mistake... THANKS!!!!!!!!!!!!!!

Luca Hartman

unread,
Oct 5, 2023, 11:22:29 AM10/5/23
to
Hi... could you be of help?

I am having the same issue, here is my syntax:

write out="Data Outfiles/Temp/OutcomesFileName baseline.sps"
/" save outfile='Data Outfiles\Outcomes 22-23 baseline. Generated ", Years, ".", Months, ".", Days, ".sav' ".
write out="Data Outfiles\Temp\OutcomesFileName baseline.sps"
/ "/KEEP ID Date OQSymptomDistress OQInterpersonalRel OQSocialRole OQTotal ".

>Error # 1. Command name: /KEEP
>The first word in the line is not recognized as an SPSS command.
>This command not executed.

Any clue what the issue may be?

Rich Ulrich

unread,
Oct 5, 2023, 9:00:41 PM10/5/23
to
First: The Subject line does not fit the question, if you are
intending to write those lines to a file - which is what your WRITE
does.
https://www.ibm.com/docs/en/spss-statistics/29.0.0?topic=write-overview-command

Second: I have used < Write out = ... > a lot, but I think
that I have never tried to give the same file name for
two "Write" commands. I suspect that it tried to open
the file as a separate file from the first one, which would
not be useful. And should generate some error message.
(If I'm wrong ... then it is a mystery.)

So. I guess the message that you see is not apt, but I suspect
that two Write's with the same out= is what leads to it.

In any case, you do not NEED a second Write command. You
can write two lines by putting in a "/" to ask for a new line.

So. Replace the "." at the end of the first written-out line
with a blank and delete the second "write out=" line . Your
"/KEEP line already starts with a "/".

--
Rich Ulrich

0 new messages