Multiple comments within a procedure

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

Multiple comments within a procedure

Art Kendall
I may be getting my packages/languages mixed up.
I thought comments could be embedded within a command.
[My workaround was to follow my usual habit of just having a long in-line
set of comments.

* age is not true zero meaning under 1 year if other variables say
illogical.
If  (Range(Education, 2,9)) OR /* has some education */
    (Literacy EQ 3) OR         /* is literate */
    (Employ.Perm EQ 3) OR      /* is permanently employed */
    (ANY(Role, 2,3,4,5,6)) OR  /* has role in survey */
    (NOT Any (Occupation, -24,1,16,45)) OR /* has an occupation */
    (Any (Relation.Head.HH,2,3,6,8,9,12))  /* relation to Head of HH  cannot
be an infant */
    NotAgeZero =1.



-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Multiple comments within a procedure

Jeff A
I was ready to say that this was SAS syntax, but it works. ...didn't know
you could do that in SPSS.

Jeff


-----Original Message-----
From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Art
Kendall
Sent: Monday, July 27, 2020 5:24 AM
To: [hidden email]
Subject: Multiple comments within a procedure

I may be getting my packages/languages mixed up.
I thought comments could be embedded within a command.
[My workaround was to follow my usual habit of just having a long in-line
set of comments.

* age is not true zero meaning under 1 year if other variables say
illogical.
If  (Range(Education, 2,9)) OR /* has some education */
    (Literacy EQ 3) OR         /* is literate */
    (Employ.Perm EQ 3) OR      /* is permanently employed */
    (ANY(Role, 2,3,4,5,6)) OR  /* has role in survey */
    (NOT Any (Occupation, -24,1,16,45)) OR /* has an occupation */
    (Any (Relation.Head.HH,2,3,6,8,9,12))  /* relation to Head of HH  cannot
be an infant */
    NotAgeZero =1.



-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

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


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

=====================
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: Multiple comments within a procedure

Bruce Weaver
Administrator
In reply to this post by Art Kendall
Hi Art.  I have sometimes used scratch variables for tasks like that.  Good
variable names pretty much take the place of comments.


COMPUTE #HasSomeEduc   = Range(Education, 2,9).
COMPUTE #IsLiterate    = Literacy EQ 3.
COMPUTE #PermEmploy    = Employ.Perm EQ 3.
COMPUTE #HasRoleInSvy  = ANY(Role, 2,3,4,5,6).
COMPUTE #HasOccup      = NOT ANY(Occupation, -24,1,16,45).
COMPUTE #NotInfant     = ANY (Relation.Head.HH,2,3,6,8,9,12).
COMPUTE NotAgeZero     = ANY(
 #HasSomeEduc, #IsLiterate, #PermEmploy,
 #HasRoleInSvy, #HasOccup, #NotInfant).
FORMATS NotAgeZero (F1).
FREQUENCIES NotAgeZero.




Art Kendall wrote

> I may be getting my packages/languages mixed up.
> I thought comments could be embedded within a command.
> [My workaround was to follow my usual habit of just having a long in-line
> set of comments.
>
> * age is not true zero meaning under 1 year if other variables say
> illogical.
> If  (Range(Education, 2,9)) OR /* has some education */
>     (Literacy EQ 3) OR         /* is literate */
>     (Employ.Perm EQ 3) OR      /* is permanently employed */
>     (ANY(Role, 2,3,4,5,6)) OR  /* has role in survey */
>     (NOT Any (Occupation, -24,1,16,45)) OR /* has an occupation */
>     (Any (Relation.Head.HH,2,3,6,8,9,12))  /* relation to Head of HH
> cannot
> be an infant */
>     NotAgeZero =1.
>
>
>
> -----
> Art Kendall
> Social Research Consultants
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple comments within a procedure

Jon Peck
In reply to this post by Art Kendall
From the CSR

Syntax Rules
• The first line of a comment can begin with the keyword COMMENT or with an asterisk (*). Comment text
can extend for multiple lines and can contain any characters.
• Use /* and */ to set off a comment within a command. The comment can be placed wherever a blank
is valid (except within strings) and should be preceded by a blank. Comments within a command cannot
be continued onto the next line.
• The closing */ is optional when the comment is at the end of the line. The command can continue onto
the next line just as if the inserted comment was a blank.
• Comments cannot be inserted within data lines.
• A comment on a separate line by itself within a command will cause an error. The comment line will be
interpreted as a blank line, which is interpreted as a command terminator.

On Sun, Jul 26, 2020 at 1:24 PM Art Kendall <[hidden email]> wrote:
I may be getting my packages/languages mixed up.
I thought comments could be embedded within a command.
[My workaround was to follow my usual habit of just having a long in-line
set of comments.

* age is not true zero meaning under 1 year if other variables say
illogical.
If  (Range(Education, 2,9)) OR /* has some education */
    (Literacy EQ 3) OR         /* is literate */
    (Employ.Perm EQ 3) OR      /* is permanently employed */
    (ANY(Role, 2,3,4,5,6)) OR  /* has role in survey */
    (NOT Any (Occupation, -24,1,16,45)) OR /* has an occupation */
    (Any (Relation.Head.HH,2,3,6,8,9,12))  /* relation to Head of HH  cannot
be an infant */
    NotAgeZero =1.



-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

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


--
Jon K Peck
[hidden email]

===================== 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: Multiple comments within a procedure

Art Kendall
In reply to this post by Jeff A
No it did not work.



-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Multiple comments within a procedure

Art Kendall
In reply to this post by Jon Peck
In the actual syntax window, that next to last line about Relation.Head.HH
did not wrap.

I THOUGHT the snippet did not work because {OR, EQ, NOT}  after the first OR
did not change colors.
I did not try to run the syntax, because when I re-read it all the rest of
the test was black.
So the syntax did work.  The coloring did not.



-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Art Kendall
Social Research Consultants