SPSS help to rearrange a data

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

SPSS help to rearrange a data

jaycamh
Hello,
I have millions of records with an alcohol variable (drinker30d) as drinking in last 30d as YES or NO. I want to convert the "drinker30d" into "drinker365d" using another survey's drinking distribution %. This imputation has to be done "by chance". For the drinker365d I have a distribution as 10% abstainers, 10% former, 20% non-30d drinkers, 60% 30d drinkers.

I have given a smaller sample of 20 and i have drinker30d data and I want to achieve drinker past year. Basically, i want to convert the 0 in drinker30d into either 1 or 2 or 3 by chance given the distribution of 1/2/3 (as10%, 10% 20%). Drinker365d should look like the 3rd column. 

I am not sure how I can use random function in SPSS. Please help!!!

id drinker 30d drinker past year
14 0 1
18 0 1
16 0 2
4 0 2
10 0 3
20 0 3
15 0 3
17 0 3
2 1 4
5 1 4
8 1 4
9 1 4
6 1 4
19 1 4
12 1 4
7 1 4
11 1 4
13 1 4
1 1 4
3 1 4
ASSIGN BY CHANCE
10% abstainer 1
10% former 2
20% non-30d drinker 3
60% 30d drinker 4
===================== 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