|
Hi All,
I need to run these steps on 10 different data sets and was wondering how to write a macro for it: sort cases by id. match files file = * /keep = ID Term HS_GPA HS_PCT HIGHEST ETS_SCHOOL ETS_TYPE ETS_DEGREE TOP_25 TOP_50 TOP_75 COLL_GPA. do if $casenum = 1. compute dup = 0. else. compute dup = id = lag(id). end if. exe. select if dup =0. exe. delete variables dup. Thanks, Keval ===================== 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 |
|
Hi,
assuming that all files are in the same dir you could do the following (untested): file handle base_dir / name = 'd:\temp'. define mymac (!pos !cmdend). !do !file_name !in (!1). get file = !quote(!concat('base_dir/',!file_name, '.sav')) /keep = ID Term HS_GPA HS_PCT HIGHEST ETS_SCHOOL ETS_TYPE ETS_DEGREE TOP_25 TOP_50 TOP_75 COLL_GPA. sort cases by id. do if $casenum = 1. compute dup = 0. else. compute dup = id = lag(id). end if. exe. select if dup =0. xsave outfile = !quote(!concat('base_dir/', !file_name, '_adjusted.sav')) / drop = dup. !doend. exe. !enddefine. mymac file1 file2 file3 filex. If you want to process _all_ files of a given dir, it's nicer to write a small Python program for that. Cheers!! Albert-Jan --- On Fri, 7/25/08, Keval Khichadia <[hidden email]> wrote: > From: Keval Khichadia <[hidden email]> > Subject: macro > To: [hidden email] > Date: Friday, July 25, 2008, 6:17 PM > Hi All, > I need to run these steps on 10 different data sets and was > wondering how to write a macro for it: > sort cases by id. > match files file = * > /keep = ID Term HS_GPA HS_PCT HIGHEST ETS_SCHOOL ETS_TYPE > ETS_DEGREE TOP_25 TOP_50 TOP_75 COLL_GPA. > do if $casenum = 1. > compute dup = 0. > else. > compute dup = id = lag(id). > end if. > exe. > select if dup =0. > exe. > delete variables dup. > Thanks, > Keval > > ===================== > 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 ===================== 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 |
