# MAGIC?

14 messages
Open this post in threaded view
|

## MAGIC?

Open this post in threaded view
|

## Re: MAGIC?

David,

This is modeled after some work done by Kirill, so he gets the credit. He also has a macro, which I changed somewhat, that sorts multiple columns keeping the data intact across columns and provides the frequency of each of the combinations of values across columns. I was going to adapt it for use in the Bayesian bootstrap of correlations, making sure that it kept value pairs together, but as it turned out, I didn't need it, but I did file it away for possible future use. His title is for the multicolumn sorting is "INTERACTION DUMMY VARIABLES AND MULTI-WAY FREQUENCY AGGREGATION" .

Brian

From: SPSSX(r) Discussion <[hidden email]> on behalf of David Marso <[hidden email]>
Sent: Tuesday, June 19, 2018 12:22:14 PM
To: [hidden email]
Subject: MAGIC?

I've been looking over Brian Dates' Bootstrapping code and came across a
truly marvelous GEM which can only be described as Magical.

Here is a self contained instance.

MATRIX.
COMPUTE Data={1,4,7,  2,3,5,  6,8,9,  0,2,1,  3,4,5,  8,7,5,  6,3,1}.
COMPUTE Sort=Data.
PRINT Sort.
END MATRIX.

Run MATRIX procedure:

SORT
0  1  1  1  2  2  3  3  3  4  4  5  5  5  6  6  7  7  8  8  9

------ END MATRIX -----

I have generalized this to sort multiple columns as follows.

MATRIX.
COMPUTE Data={1,4,7;  2,3,5;  6,8,9;  0,2,1;  3,4,5;  8,7,5;  6,3,1}.
PRINT Data.
COMPUTE Sorted=Data.
LOOP #=1 TO NCOL(Data).
COMPUTE Temp=Data(:,#).
COMPUTE Sorted(:,#)=Temp.
END LOOP.
PRINT Sorted.
END MATRIX.

DATA
1  4  7
2  3  5
6  8  9
0  2  1
3  4  5
8  7  5
6  3  1

SORTED
0  2  1
1  3  1
2  3  5
3  4  5
6  4  5
6  7  7
8  8  9

I really wonder WTF is going on under the hood ;-))
I always thought one had to manually reorder the data using the "GRADE"s as
Pointers.... WRONG!
Somebody truly had their shit together!

-----
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
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

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

## Re: MAGIC?

Open this post in threaded view
|

## Re: MAGIC? -SORT in place in MATRIX-.

 Administrator In fact we don't even need to make a copy. MATRIX. COMPUTE B={5,4,3,2}. COMPUTE B=B(GRADE(B)). PRINT B. END MATRIX. Run MATRIX procedure:   B   2  3  4  5   ------ END MATRIX ----- ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" -- 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 Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Open this post in threaded view
|

## Re: MAGIC? -SORT in place in MATRIX-.

 It's really no different from B[1,2,3,4].On Tue, Jun 19, 2018 at 6:29 PM, David Marso wrote:In fact we don't even need to make a copy. MATRIX. COMPUTE B={5,4,3,2}. COMPUTE B=B(GRADE(B)). PRINT B. END MATRIX. Run MATRIX procedure: B Â  2Â  3Â  4Â  5 ------ END MATRIX ----- ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" -- 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
Open this post in threaded view
|

## Re: MAGIC?

Open this post in threaded view
|

## Re: MAGIC? -SORT in place in MATRIX-.

Open this post in threaded view
|

## Re: MAGIC?

Open this post in threaded view
|

## Re: MAGIC?

Open this post in threaded view
|

## Re: MAGIC?

Open this post in threaded view
|

## Re: MAGIC?

Open this post in threaded view
|