Adding new cases using syntax
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 33 34 | *The easiest way is to define your new variable with data list and then add your old file to it. It would look like this: DATA LIST /NEWVAR 1. BEGIN DATA 1 END DATA. ADD FILES FILE=* /FILE=OLDFILE. ********************************************************************. * var1 (a unique id variable) has gaps in it (1 2 3 . 5 6 . 8 . 10 11); values 4,7,9,and 12 are missing. * Task is to fill the gaps. * rlevesque@videotron.ca. data list free / var1 dummy. begin data 1 8 2 22 3 7 5 7 6 7 8 7 10 7 11 7 end data . DO IF $casenum=1. + LOOP varx=1 TO 12. + XSAVE OUTFILE='temp.sav' /KEEP=varx. + END LOOP. END IF. EXECUTE. MATCH FILES FILE=* /DROP=varx. MATCH FILES FILE=* /FILE='temp.sav' /RENAME= (varx=var1) /BY var1. EXECUTE. |
Related pages
...