Hello to everybody on the list: I have a data file that looks like this: dato01 3 200 dato02 1 300 dato03 10 400 dato04 4 500 For each case I want to have n copies (n is the data in the 8th column). So the result would look like this: dato01 1 200 dato01 2 200 dato01 3 200 dato02 1 300 dato03 1 400 dato03 2 400 dato03 3 400 dato03 4 400 dato03 5 400 dato03 6 400 dato03 7 400 dato03 8 400 dato03 9 400 dato03 10 400 dato04 1 500 dato04 2 500 dato04 3 500 dato04 4 500 I think the sintax would be related to LOOP, but I can't figure out how to do this. Mi data file has almost 27000 cases. Any help would be apreciated Kindly Andres |
Administrator
|
LOOP with XSAVE does it.
LOOP i = 1 to n. + XSAVE OUTFILE = "C:\Temp\NewFile.sav" / KEEP = v1 i x . END LOOP. EXECUTE. GET FILE = "C:\Temp\NewFile.sav".
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Thank you Bruce, it worked fine
LOOP with XSAVE does it. LOOP i = 1 to n. + XSAVE OUTFILE = "C:\Temp\NewFile.sav" / KEEP = v1 i x . END LOOP. EXECUTE. GET FILE = "C:\Temp\NewFile.sav". ANDRES ALBERTO BURGA LEON wrote > Hello to everybody on the list: > > I have a data file that looks like this: > > dato01 3 200 > dato02 1 300 > dato03 10 400 > dato04 4 500 > > For each case I want to have n copies (n is the data in the 8th column). > So the result would look like this: > > dato01 1 200 > dato01 2 200 > dato01 3 200 > dato02 1 300 > dato03 1 400 > dato03 2 400 > dato03 3 400 > dato03 4 400 > dato03 5 400 > dato03 6 400 > dato03 7 400 > dato03 8 400 > dato03 9 400 > dato03 10 400 > dato04 1 500 > dato04 2 500 > dato04 3 500 > dato04 4 500 > > I think the sintax would be related to LOOP, but I can't figure out how to > do this. Mi data file has almost 27000 cases. > > Any help would be apreciated > > Kindly > > Andres ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Repeating-cases-n-times-in-data-file-tp5715458p5715460.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== 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 |
Free forum by Nabble | Edit this page |