On Tue, 4 Jun 2019 14:20:35 -0700 (PDT), Bruce Weaver
<bweaver@lakeheadu.ca> wrote:
On Tuesday, June 4, 2019 at 1:26:53 PM UTC-4, Rich Ulrich wrote:
--- snip ---
I read the example differently. Isn't it asking for this?
RANK DATEvar by IDvar into Session.
--
Rich Ulrich
Right you are, Rich--although INTO doesn't appear to work with RANK.
NEW FILE.
DATASET CLOSE ALL.
DATA LIST LIST / ID (F1) Date(date) x(F1).
BEGIN DATA
1 02/01/2018 2
1 02/10/2018 3
1 04/04/2017 1
2 01/10/2015 1
2 03/04/2016 2
END DATA.
RANK VARIABLES=Date (A) BY ID.
RENAME VARIABLES (Rdate=Session).
FORMATS Session(F2.0).
LIST.
* x = desired result, Session = obtained result.
OUTPUT from LIST:
ID Date x Session
1 02-JAN-2018 2 2
1 02-OCT-2018 3 3
1 04-APR-2017 1 1
2 01-OCT-2015 1 1
2 03-APR-2016 2 2
Number of cases read: 5 Number of cases listed: 5
Well, INTO is available. I got INTO from the syntax manual,
but I didn't go far enough to get reminded of the complication.
The proper syntax seems to be,
RANK Datevar by IDvar/ rank into Session.
The second "rank" -- "rank into" -- is parsed as
<function> INTO
where a set of functions is available, as documented at https://www.ibm.com/support/knowledgecenter/en/SSLVMB_24.0.0/spss/base/syn_rank_function.html#syn_rank_function
"The functions assign default names to the new variables unless
keyword INTO is specified."
--
Rich Ulrich
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 293 |
Nodes: | 16 (2 / 14) |
Uptime: | 228:52:08 |
Calls: | 6,624 |
Calls today: | 6 |
Files: | 12,171 |
Messages: | 5,318,998 |