splitting line to spec width

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

splitting line to spec width

Analyst Artist
Hi,
I just want to know the correct syntax in splitting a line that has
greater than 80 characters?  Do I use a + or just "press enter"
whenever there is a break in the command?

For example:

IF (dateofbirth > 1968 AND (non_empl_retired = 1 OR non_empl_homemaker
= 1 OR non_empl_other = 1)) flag_var = 1.

how do i split this into 80 char increment lines?  Is it just like
this?

IF (dateofbirth > 1968 AND (non_empl_retired = 1
OR non_empl_homemaker = 1 OR non_empl_other = 1))
flag_var = 1.


Thanks in advance.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: splitting line to spec width

Richard Ristow
At 12:52 PM 10/28/2008, Analyst Artist wrote:

>I just want to know the correct syntax in splitting a line that has
>greater than 80 characters?  Do I use a + or just "press enter"
>whenever there is a break in the command?

You "press enter", i.e. break the line, anywhere there's a space or
where a space would be allowed, >except< in the middle of a string in quotes.

It is wise to indent all but the first line of every command,
and >not< to indent the first line, so to conform with SPSS 'batch'
syntax rules. (In the *Command Syntax Reference*, see Universals >
Commands > Running commands.)

So, you have,

>For example:
>
>IF (dateofbirth > 1968 AND (non_empl_retired = 1 OR non_empl_homemaker
>= 1 OR non_empl_other = 1)) flag_var = 1.
>
>how do i split this into 80 char increment lines?  Is it just like this?
>
>IF (dateofbirth > 1968 AND (non_empl_retired = 1
>OR non_empl_homemaker = 1 OR non_empl_other = 1))
>flag_var = 1.

Yes, but the following is preferable

IF (dateofbirth > 1968 AND (non_empl_retired = 1
    OR non_empl_homemaker = 1 OR non_empl_other = 1))
    flag_var = 1.

If you're posting to SPSSX-L, it's best to break into 72-character
lines; the list redistributor will fold lines longer than 72 characters.

If you choose (I recommend this, but it's a matter of style), break
and indent your lines to emphasize the command's logical structure, for example

IF    (dateofbirth > 1968
   AND (non_empl_retired   = 1
     OR non_empl_homemaker = 1
     OR non_empl_other     = 1))
    flag_var = 1.

If you need to break a string that's in quotes, close the first part
of the string with a quote, end the line with a "+" sign, and start
the next part of the string with a quote, on the next line.  For example,

COMPUTE LongIsh = 'This is a fairly long string, right?'.

can be written

COMPUTE LongIsh = 'This is a fairly ' +
                   'long string, right?'.


............................................
Then, if you want to get fancy, there're always syntax alternatives,
like the ANY function:

IF       (dateofbirth > 1968
   AND ANY(1,non_empl_retired,non_empl_homemaker,non_empl_other))
    flag_var = 1.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Problem with OMS

Cleland, Patricia (EDU)
I have SPSS syntax that creates 4 custom tables. (All 4 are created
using the same ctables commands, the only difference is that each table
has different selection criteria.)

I want to merge the 4 tables into a single table.

Here is the syntax that I'm using:

OMS
  /SELECT TABLES
  /IF COMMANDS = ['ctables']
  /DESTINATION FORMAT = sav
  OUTFILE= 'C:\UserData\Temp\ctables'.

OMSEND.

The syntax creates a file called ctables but it only has three
variables:

Command_
Subtype_
Label_

And all the cells are empty.

The really strange thing is that it ran just fine earlier today. (I need
to re-run the analysis because the data has been updated.)

I'm running v15. Can anyone see what I'm doing wrong?

Thanks.

Pat

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Problem with OMS

Oliver, Richard
The CTABLES command that should appear between OMS and OMSEND is conspicuous in its absence.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Cleland, Patricia (EDU)
Sent: Tuesday, October 28, 2008 3:15 PM
To: [hidden email]
Subject: Problem with OMS

I have SPSS syntax that creates 4 custom tables. (All 4 are created
using the same ctables commands, the only difference is that each table
has different selection criteria.)

I want to merge the 4 tables into a single table.

Here is the syntax that I'm using:

OMS
  /SELECT TABLES
  /IF COMMANDS = ['ctables']
  /DESTINATION FORMAT = sav
  OUTFILE= 'C:\UserData\Temp\ctables'.

OMSEND.

The syntax creates a file called ctables but it only has three
variables:

Command_
Subtype_
Label_

And all the cells are empty.

The really strange thing is that it ran just fine earlier today. (I need
to re-run the analysis because the data has been updated.)

I'm running v15. Can anyone see what I'm doing wrong?

Thanks.

Pat

=====================
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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: splitting line to spec width

Albert-Jan Roskam
In reply to this post by Analyst Artist
Hi,

You should indent it with either a tab or some spaces. e.g.:

SAVE OUTFILE = 'd:/temp/blah.sav'
    / KEEP = var1 to var10
    / COMPRESSED.

Cheers!!
Albert-Jan


--- On Tue, 10/28/08, Analyst Artist <[hidden email]> wrote:

> From: Analyst Artist <[hidden email]>
> Subject: splitting line to spec width
> To: [hidden email]
> Date: Tuesday, October 28, 2008, 5:52 PM
> Hi,
> I just want to know the correct syntax in splitting a line
> that has
> greater than 80 characters?  Do I use a + or just
> "press enter"
> whenever there is a break in the command?
>
> For example:
>
> IF (dateofbirth > 1968 AND (non_empl_retired = 1 OR
> non_empl_homemaker
> = 1 OR non_empl_other = 1)) flag_var = 1.
>
> how do i split this into 80 char increment lines?  Is it
> just like
> this?
>
> IF (dateofbirth > 1968 AND (non_empl_retired = 1
> OR non_empl_homemaker = 1 OR non_empl_other = 1))
> flag_var = 1.
>
>
> Thanks in advance.
>
> =====================
> 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

=====================
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