using "?" in the variable label to refer to a group of variables

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

using "?" in the variable label to refer to a group of variables

Carmen
I have a set of variables labelled gs010_1 gs010_2 gs010_3 [...] gs010_7.
In stata I can refer to all of them by writing gs010_?. The ? will
automatically be replaced by 1, 2, 3 [...] and 7. Is there something
similar in SPSS?

Thanks a lot,
Carmen

=====================
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: using "?" in the variable label to refer to a group of variables

Albert-Jan Roskam
Are you talking about variable labels or variable names? If it's about var labels, you can use TO, as in 'gs010_1 TO gs010_99.
 
Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



From: Carmen <[hidden email]>
To: [hidden email]
Sent: Fri, May 27, 2011 10:12:53 AM
Subject: [SPSSX-L] using "?" in the variable label to refer to a group of variables

I have a set of variables labelled gs010_1 gs010_2 gs010_3 [...] gs010_7.
In stata I can refer to all of them by writing gs010_?. The ? will
automatically be replaced by 1, 2, 3 [...] and 7. Is there something
similar in SPSS?

Thanks a lot,
Carmen

=====================
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: using "?" in the variable label to refer to a group of variables

Carmen
In reply to this post by Carmen
Sorry, I am talking about variable names.

For the moment, when I'm writing a syntax I have to list all variables. For
instance:

Frequencies gs010_1 gs010_2 gs010_3 and so on until gs010_7.

And I was wondering if there is a way to make it shorter. I know that in
stata it is possible to write it like this:

Frequencies gs010_?

Best,
Carmen


On Fri, 27 May 2011 03:26:07 -0700, Albert-Jan Roskam <[hidden email]> wrote:

>Are you talking about variable labels or variable names? If it's about var
>labels, you can use TO, as in 'gs010_1 TO gs010_99.
> Cheers!!
>Albert-Jan
>
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>All right, but apart from the sanitation, the medicine, education, wine, public
>order, irrigation, roads, a fresh water system, and public health, what
have the

>Romans ever done for us?
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>________________________________
>From: Carmen <[hidden email]>
>To: [hidden email]
>Sent: Fri, May 27, 2011 10:12:53 AM
>Subject: [SPSSX-L] using "?" in the variable label to refer to a group of
>variables
>
>I have a set of variables labelled gs010_1 gs010_2 gs010_3 [...] gs010_7.
>In stata I can refer to all of them by writing gs010_?. The ? will
>automatically be replaced by 1, 2, 3 [...] and 7. Is there something
>similar in SPSS?
>
>Thanks a lot,
>Carmen
>
>=====================
>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: using "?" in the variable label to refer to a group of variables

Bruce Weaver
Administrator
If the variables are contiguous, then you can use TO, as shown by Albert-Jan.  I.e.,

Frequencies gs010_1 TO gs010_7.

If they are not contiguous, and if you will be using the same set of variables repeatedly, you can use a macro to define the variable list.  Here's a variation on an example from the "fine" manual.  

DEFINE !myvars ()
gs010_1 gs010_2 gs010_3  gs010_4  gs010_5  gs010_6  gs010_7
!ENDDEFINE.

FREQUENCIES !myvars.
DESCRIPTIVES !myvars.

etc

HTH.


Carmen wrote
Sorry, I am talking about variable names.

For the moment, when I'm writing a syntax I have to list all variables. For
instance:

Frequencies gs010_1 gs010_2 gs010_3 and so on until gs010_7.

And I was wondering if there is a way to make it shorter. I know that in
stata it is possible to write it like this:

Frequencies gs010_?

Best,
Carmen


On Fri, 27 May 2011 03:26:07 -0700, Albert-Jan Roskam <[hidden email]> wrote:

>Are you talking about variable labels or variable names? If it's about var
>labels, you can use TO, as in 'gs010_1 TO gs010_99.
> Cheers!!
>Albert-Jan
>
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>All right, but apart from the sanitation, the medicine, education, wine, public
>order, irrigation, roads, a fresh water system, and public health, what
have the
>Romans ever done for us?
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>________________________________
>From: Carmen <[hidden email]>
>To: [hidden email]
>Sent: Fri, May 27, 2011 10:12:53 AM
>Subject: [SPSSX-L] using "?" in the variable label to refer to a group of
>variables
>
>I have a set of variables labelled gs010_1 gs010_2 gs010_3 [...] gs010_7.
>In stata I can refer to all of them by writing gs010_?. The ? will
>automatically be replaced by 1, 2, 3 [...] and 7. Is there something
>similar in SPSS?
>
>Thanks a lot,
>Carmen
>
>=====================
>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
--
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/).
Reply | Threaded
Open this post in threaded view
|

Re: using "?" in the variable label to refer to a group of variables

Jon K Peck
In addition to these solutions, you can use the extension command SPSSINC SELECT VARIABLES or its associated dialog box, Utilities>Define Variable Macro to create a macro listing variables based on one or more of a name wildcard (actually regular expression), variable type, measurement level and custom attributes.  This command is available from the SPSS Community website (www.ibm.com/developerworks/spssdevcentral).  It requires the Python Essentials also available from that site.

HTH,

Jon Peck
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        Bruce Weaver <[hidden email]>
To:        [hidden email]
Date:        05/27/2011 06:36 AM
Subject:        Re: [SPSSX-L] using "?" in the variable label to refer to a group              of              variables
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




If the variables are contiguous, then you can use TO, as shown by Albert-Jan.
I.e.,

Frequencies gs010_1 TO gs010_7.

If they are not contiguous, and if you will be using the same set of
variables repeatedly, you can use a macro to define the variable list.
Here's a variation on an example from the "fine" manual.

DEFINE !myvars ()
gs010_1 gs010_2 gs010_3  gs010_4  gs010_5  gs010_6  gs010_7
!ENDDEFINE.

FREQUENCIES !myvars.
DESCRIPTIVES !myvars.

etc

HTH.



Carmen wrote:
>
> Sorry, I am talking about variable names.
>
> For the moment, when I'm writing a syntax I have to list all variables.
> For
> instance:
>
> Frequencies gs010_1 gs010_2 gs010_3 and so on until gs010_7.
>
> And I was wondering if there is a way to make it shorter. I know that in
> stata it is possible to write it like this:
>
> Frequencies gs010_?
>
> Best,
> Carmen
>
>
> On Fri, 27 May 2011 03:26:07 -0700, Albert-Jan Roskam
> &lt;[hidden email]&gt; wrote:
>
>>Are you talking about variable labels or variable names? If it's about var
>>labels, you can use TO, as in 'gs010_1 TO gs010_99.
>> Cheers!!
>>Albert-Jan
>>
>>
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>All right, but apart from the sanitation, the medicine, education, wine,
public
>>order, irrigation, roads, a fresh water system, and public health, what
> have the
>>Romans ever done for us?
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>>
>>
>>
>>________________________________
>>From: Carmen &lt;[hidden email]&gt;
>>To: [hidden email]
>>Sent: Fri, May 27, 2011 10:12:53 AM
>>Subject: [SPSSX-L] using "?" in the variable label to refer to a group of
>>variables
>>
>>I have a set of variables labelled gs010_1 gs010_2 gs010_3 [...] gs010_7.
>>In stata I can refer to all of them by writing gs010_?. The ? will
>>automatically be replaced by 1, 2, 3 [...] and 7. Is there something
>>similar in SPSS?
>>
>>Thanks a lot,
>>Carmen
>>
>>=====================
>>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
>


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

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/using-in-the-variable-label-to-refer-to-a-group-of-variables-tp4431199p4431740.html
Sent from the SPSSX Discussion mailing list archive at 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