Dept Count Title Function
ABC 2 Office Worker 3rd Floor
ABC 1 Office Worker 1st Floor
ABC 2 Non-Office Worker 3rd Floor
ABC 2 Non-Office Worker 1st Floor
XYZ 5 Office Worker 3rd Floor
XYZ 7 Office Worker 2nd Floor
etc.
For instance, the first record tells me that Dept ABC has 2 Office
Workers on the 3rd floor.
I need to restructure the dataset so each person gets his own row/
record. For instance, the first record would become two records:
ABC 1 Office Worker 3rd Floor
ABC 1 Office Worker 3rd Floor
In this case, I don’t really need to keep the count variable.
Any suggestions how to restructure this with syntax? I’m not even sure
where to start.
Thank you.
> I have a dataset that looks like this:
>
> Dept Count Title Function
> ABC 2 Office Worker 3rd Floor
> ABC 1 Office Worker 1st Floor
> ABC 2 Non-Office Worker 3rd Floor
> ABC 2 Non-Office Worker 1st Floor
> XYZ 5 Office Worker 3rd Floor
> XYZ 7 Office Worker 2nd Floor
> etc.
>
> For instance, the first record tells me that Dept ABC has 2 Office
> Workers on the 3rd floor.
>
> I need to restructure the dataset so each person gets his own row/
> record. For instance, the first record would become two records:
>
> ABC 1 Office Worker 3rd Floor
> ABC 1 Office Worker 3rd Floor
Have you considered just weighting by the count variable?
--
Ben Pfaff
http://benpfaff.org
I need to assign a random number to each individual worker. This
requires that each person be on his own row.
I don't have SPSS on this machine, so the following is untested.
LOOP #i = 1 to count.
- xsave outfile = "C:\temp\one_record_per_person.sav" /
keep = dept title function.
END LOOP.
exe.
Now open the new file and compute your random number.
--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."
At the same time as saving this first file, I think that
I would save a counter for within-the-department, and
probably the Random number, if that is going to be the
unique case ID. Modifying Bruce's --
LOOP DeptID = 1 to count.
compute RandID = < whatever > .
- xsave outfile = "C:\temp\one_record_per_person.sav" /
keep = dept title function DeptID RandID
END LOOP.
exe.
--
Rich Ulrich