Date: Fri, 18 Mar 2011 15:57:08 -0400
Reply-To: Gene Maguin <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Gene Maguin <email@example.com>
I understand your problem correctly, i think you need to construct a
counting variable that resets when you encounter a different combination of
country, wave, study. This question gets aske periodically and there may be
several different ways of doing it. My way is this.
sort cases by country wave study.
** I'm assuming that the order of person within country-wave-study is
if (country eq lag(country) and wave eq lag(wave) and study eq lag(study)
You may want leading digits on the ccr variable. One way is 'N' format, as
in format ccr(n4) or (n2). The other way, more obvious, is to start ccr at
101 or 1001 or 100000001, whatever.
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Friday, March 18, 2011 1:48 PM
Subject: "partitioned" id-variable
I am about to set up an id-variable consisting of several parts. The code
has to be composed of
3 digits for "country"
2 digits for "wave"
1 digit for "study"
4 digits for "continuous respondent number".
Resulting in a code [cccc][ww][s][nnnn].
The first three parts are no problem. However, the last part is hideous. I
need a continuous code per "cell", e.g. respondents in Spain in wave 2 in
study type 1 need to be counted from 1 to 1500.
I tried several variants with $casenum (i.e. do if; temp. sel if; split
file), but $casenum does not react to anything but the case's position in
Unfortunately, it is no viable solution to split the file into several files
(as this would have to be performed by our users).
Does anyone of you see a solution to this tricky job?