```Date: Fri, 18 Mar 2011 15:57:08 -0400 Reply-To: Gene Maguin Sender: "SPSSX(r) Discussion" From: Gene Maguin Subject: =?US-ASCII?Q?RE:_=22partitioned=22_id-variable?= In-Reply-To: <20110318174737.189110@gmx.net> Content-Type: multipart/alternative; Jara, 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 irrelevant. compute ccr=1. if (country eq lag(country) and wave eq lag(wave) and study eq lag(study) ccr=1+lag(ccr). 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. Gene Maguin _____ From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Jara Kampmann Sent: Friday, March 18, 2011 1:48 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: "partitioned" id-variable Dear List, 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 the file. 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? Best, Jara [text/html] ```

Back to: Top of message | Previous page | Main SPSSX-L page