Create consecutive records at the end of the file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | * problem is to add records such as * 4 d * 5 e * etc at the end of this file. * Raynald Levesque 2004/04/07 . DATA LIST LIST /var1(F8) var2(A1). BEGIN DATA 1 a 2 b 3 c END DATA. * Identify last case of the file. COMPUTE nobreak=1. ADD FILES FILE=* /BY=nobreak /LAST=last. STRING #alpha(A26). COMPUTE #alpha="abcdefghijklmnopqrstuvwxyz". * Add 3 cases at the end of the file (could use any number instead of 3). LOOP #cnt=1 TO 1 + 3*last . - DO IF #cnt > 1. - COMPUTE var1=var1 + 1. - COMPUTE var2=SUBSTR(#alpha,var1,1). - END IF. - XSAVE OUTFILE='c:\\temp\\extended file.sav' /DROP=nobreak last. END LOOP. EXECUTE. GET FILE='c:\\temp\\extended file.sav'. LIST. |
Related pages
...