Replicating or copying cases n times

Jo77

New Member
#1
Hello, just wondering if anyone can please help me with SPSS Syntax.

By using syntax, which is the best way to make copies of a case line based on a value in another variable?

In my example one respondent answered on behalf of x number of doctors in their practice (number of doctors is in a numeric variable called 'group'). So if one case line represents answers for 3 doctors I want to duplicate that case line by 3.

Before:
ID v1 v2 v3 group
1 2 6 7 1
2 6 8 9 2
3 5 7 4 3

After:
ID v1 v2 v3 group
1 2 6 7 1
2 6 8 9 2
2 6 8 9 2
3 5 7 4 3
3 5 7 4 3
3 5 7 4 3

Thank you! :)