Date: Mon, 19 Mar 2012 17:56:47 +0000
Reply-To: Joan Casellas <jcasellasvega@HOTMAIL.CO.UK>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Joan Casellas <jcasellasvega@HOTMAIL.CO.UK>
Subject: FW: random sample of cases by groups
In-Reply-To: <000901cd05f9$0603f290$120bd7b0$@casellas@eu-survey.com>
Content-Type: multipart/alternative;
Hi Everyone,
I was wondering if someone could help me . I’m trying to select a random sample base on three different variables (at the same time). So far I’ve got a syntax that does it based on one variable (see syntax below). The variables and the proportion I would need to use are described next:
total
1
Count
Column N %
Gender
Female
1000
100.0%
Total
1000
100.0%
Age
18-24
400
40.0%
25-34
290
29.0%
35-44
180
18.0%
45-54
100
10.0%
55-64
20
2.0%
65+
10
1.0%
Total
1000
100.0%
Region
East Anglia
-
East Midlands & West Midlands & East Anglia
100
10.0%
Northern & Yorkshire/Humberside
150
15.0%
Northern Ireland
-
Northwest
120
12.0%
Scotland
140
14.0%
Southeast
400
40.0%
Southwest
60
6.0%
Wales
30
3.0%
West Midlands
-
Yorkshire/Humberside
-
Total
1000
100.0%
Social Grade
A
60
6.0%
B
270
27.0%
C1
380
38.0%
C2
170
17.0%
D
100
10.0%
E
20
2.0%
Total
1000
100.0%
Any suggestions will be really appreciate it.
Thanks in advance!!!!
Joan
COMPUTE SCRAMBLE=UNIFORM(1).
SORT CASES BY AGE SCRAMBLE.
IF $CASENUM=1 OR (LAG(age) NE age) Counter=1.
IF MISSING(Counter) Counter=LAG(Counter)+1.
COMPUTE Keeper=Age.
RECODE Keeper (1=48)(2=100)(3=150)(4=125)(5=86)(6=15).
SELECT IF (Counter LE Keeper).
FREQ Age.
[text/html]