creating custom attribute for original order.

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

creating custom attribute for original order.

Art Kendall
Sometimes I need to group string or nominal variables, so I use SORT
VARIABLES.  
After doing something like AUTORECODE on the string variables, I need to put
the variables back in the original order.
I tried creating a custom attribute. With something like Pos01 to Pos93 or
#01 to #93 or 1 to 93 as the values. That way I could sort on the custom
variable.

VARIABLE ATTRIBUTE
    VARIABLES =  ALL
    ATTRIBUTE = Input.Order('Pos') arrayname[93].

Variable Attribute No value was specified for attribute "arrayname".

With only 93 variables it is probably faster to type the contents in,
However, I thought others might need something like this, so I am posting.



-----
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: creating custom attribute for original order.

Jon Peck
If you use Data > Sort Variables and check the box Save the current order in a new attribute, you can recover the original order using that attribute by using it in a subsequent sort, e.g.,
SORT VARIABLES BY ATTRIBUTE oldorder (A).

On Fri, Aug 7, 2020 at 9:51 AM Art Kendall <[hidden email]> wrote:
Sometimes I need to group string or nominal variables, so I use SORT
VARIABLES. 
After doing something like AUTORECODE on the string variables, I need to put
the variables back in the original order.
I tried creating a custom attribute. With something like Pos01 to Pos93 or
#01 to #93 or 1 to 93 as the values. That way I could sort on the custom
variable.

VARIABLE ATTRIBUTE
    VARIABLES =  ALL
    ATTRIBUTE = Input.Order('Pos') arrayname[93].

Variable Attribute No value was specified for attribute "arrayname".

With only 93 variables it is probably faster to type the contents in,
However, I thought others might need something like this, so I am posting.



-----
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: creating custom attribute for original order.

Art Kendall
thank you.

it is interesting that FORMAT is the TYPE as a string and WIDTH also as a
string.

Followers of this list are probably aware that I emphasize complete data
definition before any analysis.

I hit my self on the head when I just now realized that sequentially using
SORT VARIABLES for LABEL,   VALUES, or  MISSING
would be a great help in this quality assurance part of the process.





-----
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: creating custom attribute for original order.

Jon Peck
In reply to this post by Art Kendall
If you want to record the original order for later use with SORT VARIABLES, this will do it.

begin program python3.
import spss
for i in range(spss.GetVariableCount()):
   spss.Submit("""VARIABLE ATTRIBUTE VARIABLES = %s ATTRIBUTE=OrigOrder('%04d').""" %\
      (spss.GetVariableName(i), i))
end program.

On Fri, Aug 7, 2020 at 9:51 AM Art Kendall <[hidden email]> wrote:
Sometimes I need to group string or nominal variables, so I use SORT
VARIABLES. 
After doing something like AUTORECODE on the string variables, I need to put
the variables back in the original order.
I tried creating a custom attribute. With something like Pos01 to Pos93 or
#01 to #93 or 1 to 93 as the values. That way I could sort on the custom
variable.

VARIABLE ATTRIBUTE
    VARIABLES =  ALL
    ATTRIBUTE = Input.Order('Pos') arrayname[93].

Variable Attribute No value was specified for attribute "arrayname".

With only 93 variables it is probably faster to type the contents in,
However, I thought others might need something like this, so I am posting.



-----
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: creating custom attribute for original order.

Art Kendall
Thank you.

This will be particularly helpful now that I realize the usefulness of
SORT VARIABLES in cleaning up LABEL VALUES & MISSING attributes.



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