I write them because I need to assign quotas (sex and age) for a sample in an aleatory way. The format of the database in spss is the following one:
In each cluster, I need to assign as maximum five interviewed, according to the distribution of the quotas.
What I need is that the distribution of the quotas is aleatory, the only condition is that the total of each column (ex. man 18-34) is same to the number of quota (ex. 7) and the each row is same to 5 (total of having interviewed by zip area). An example would be:
Does somebody know how it could assign aleatory quotas in spss? some suggestion of how to distribute the quotas? Thank you for the help. --
Sebastián
Daza Aranzaes |
exactly, it looks as if you have six age-sex combinations and that a total of five people are specified to be sampled across those six combinations. I then want to make draws from a uniform randon distribution for the number of people from each age-sex combination to be interviewed such that the number of persons to be interviewed sums to five. But I don't know how to make it in spss, because I have 240 clusters, and the total sample is of 1200 cases. thank you for everything. Original mail: I write them because I need to assign quotas (sex and age) for a sample in an aleatory way. The format of the database in spss is the following one:
In each cluster, I need to assign as maximum five interviewed, according to the distribution of the quotas.
What I need is that the distribution of the quotas is aleatory, the only condition is that the total of each column (ex. man 18-34) is same to the number of quota (ex. 7) and the each row is same to 5 (total of having interviewed by zip area). An example would be:
Does somebody know how it could assign aleatory quotas in spss? some suggestion of how to distribute the quotas? Thank you for the help.
--
Sebastián
Daza Aranzaes |
In reply to this post by Sebastián Daza
exactly, it looks as if you have six age-sex combinations and that a total of five people are specified to be sampled across those six combinations. I then want to make draws from a uniform randon distribution for the number of people from each age-sex combination to be interviewed such that the number of persons to be interviewed sums to five. But I don't know how to make it in spss, because I have 240 clusters, and the total sample is of 1200 cases. thank you for everything. Original mail: I write them because I need to assign quotas (sex and age) for a sample in an aleatory way. The format of the database in spss is the following one:
In each cluster, I need to assign as maximum five interviewed, according to the distribution of the quotas.
What I need is that the distribution of the quotas is aleatory, the only condition is that the total of each column (ex. man 18-34) is same to the number of quota (ex. 7) and the each row is same to 5 (total of having interviewed by zip area). An example would be:
Does somebody know how it could assign aleatory quotas in spss? some suggestion of how to distribute the quotas? Thank you for the help.
--
Sebastián
Daza Aranzaes |
In reply to this post by Sebastián Daza
Sebastian,
Here's my idea. I hope i've understood your problem correctly, and i'm not sure that i have. Let your six sex-age combination variables be called m18 m35 m55 f18 f35 f55. The goal is to specifiy the number of persons to be sampled in each of the six sex-age variables such that the sum of persons equals 5 for each record in your dataset, that is each combination of county and cluster. My scheme is to draw a random number between 1 and 6 to specify the starting age-sex variable and then draw a random numbers between 0 and 5 to specify the number of persons to select for that age-sex combination. Advance to the next age-sex combination. Draw another number between 0 and 5. However, if that number plus the sum of the previously drawn numbers is greater than 5, throw it away and draw another. Repeat until the sum is less or equal to 5. Once the sum equals 5, the remaining age-sex combinations are set to 0. The following syntax works correctly on my computer and looks to be correct, but check the results carefully that you are really getting what you want. Gene Maguin * THIS GENERATES 6 CASES WITH THE INDICATED VALUES FOR COUNTY CLUSTER CASES. INPUT PROGRAM. LOOP #I=1 TO 6. + COMPUTE COUNTY=1. + COMPUTE CLUSTER=#I. + COMPUTE CASES=5. END CASE. END LOOP. END FILE. END INPUT PROGRAM. EXECUTE. NUMERIC M18 M35 M55 F18 F35 F55. * THIS IS THE REAL PART OF THE PROJECT. Vector agesex=m18 to f55. Compute sv=trunc(uniform(5)). /* STARTING VALUE OF AGESEX VECTOR. Compute total=0. Loop #i=1 to 6. + Compute #k=mod((sv+#i),6). + if (#k eq 0) #k=6. + do if (total lt 5). + loop #j=1 to 100. + Compute draw=trunc(uniform(6)). /* CASES TO DRAW. + do if ((total+draw) le 5). + compute total=total+draw. + compute agesex(#k)=draw. + break. + end if. + end loop. + else. + compute agesex(#k)=0. + end if. End loop. EXECUTE. FORMAT COUNTY CLUSTER CASES M18 M35 M55 F18 F35 F55 SV J(F2.0). LIST COUNTY CLUSTER CASES M18 M35 M55 F18 F35 F55 SV J. |
In reply to this post by Sebastián Daza
I've got what i think is a simple question but i don't know if a command exists to do this.
I need to create a mail merge file out of a file that looks like this:. ID var1 var2 var3 1 5 2 4 2 6 0 0 3 0 0 0 I want to compute a variable that says: If (var1 ne $sysmis) var1 = "variable1 name" If (var1 = $sysmis) var1 = $sysmis. *repeat for var1 and var3 (without having to actually spell out var1) and leave a blank where this is not true. ...so that my file would look like this: ID var1 var2 var3 1 var1 var2 var3 2 var1 3 however, i don't know of a command that says "use the variable name" any ideas? Thanks Carol |
Consider using:
a) VALUE LABELS to assign the desired labels you want for each value b) SUMMARIZE to display list using these value labels in tabular format: SUMMARIZE ID var1 var2 var3 /Format= list nototal nocasenum /Cells= none . Paste resulting table into Word and do your mailmerge. Dennis Deck, PhD RMC Research Corporation [hidden email] -----Original Message----- From: Parise, Carol A. [mailto:[hidden email]] Sent: Tuesday, January 30, 2007 4:42 PM Subject: replace value with varname I've got what i think is a simple question but i don't know if a command exists to do this. I need to create a mail merge file out of a file that looks like this:. ID var1 var2 var3 1 5 2 4 2 6 0 0 3 0 0 0 I want to compute a variable that says: If (var1 ne $sysmis) var1 = "variable1 name" If (var1 = $sysmis) var1 = $sysmis. *repeat for var1 and var3 (without having to actually spell out var1) and leave a blank where this is not true. ...so that my file would look like this: ID var1 var2 var3 1 var1 var2 var3 2 var1 3 however, i don't know of a command that says "use the variable name" any ideas? Thanks Carol |
Free forum by Nabble | Edit this page |