|
Hi, all,
How can I delete variables which have >80% of missing for a particular group of people in a large dataset using syntax? Thanks Yawen ===================== 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 Yawen,
A solution in the spirit of old Raynald's syntax-creating-syntax tricks. Here it is still effective, I think. * create a sample dataset: . data list free / v1 to v4. begin data 1 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 end data. recode all (0 = sysmis). exe. dataset name source. * the solution: . DATASET DECLARE agg. temp. compute w = 1. AGGREGATE /OUTFILE='agg' /BREAK=w /v1 to v4=NMISS(v1 to v4) /N_BREAK=N. DATASET activate agg. do repe x = v1 to v4. - compute x = (100 * x / N_BREAK > 80). end repe. exe. DELETE VARIABLES w N_BREAK. FLIP. SELECT IF var001. string d (a250). compute d = concat("DELETE VARIABLES ", CASE_LBL, "."). WRITE OUTFILE= 'c:/temp/delevar.sps' /d. exe. dataset activate source. INSERT FILE='c:/temp/delevar.sps' . Change names of variables and perhaps the directory for the delevar.sps file according to your data & computer. Best regards Jan -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Yawen LI Sent: Wednesday, April 09, 2008 1:44 AM To: [hidden email] Subject: delete missing variables Hi, all, How can I delete variables which have >80% of missing for a particular group of people in a large dataset using syntax? Thanks Yawen ===================== 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 _____ Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem. This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission. -.- -- ===================== 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 |
