Autodelete empty variables?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Autodelete empty variables?

Mario Giesel
Hello all,
 
is there a quick way in a huge database to delete all variables that are SYSMIS or MISSING without looking for them?
 
Thanks for any help.
Mario

Mario Giesel
Munich, Germany
Reply | Threaded
Open this post in threaded view
|

Re: Autodelete empty variables?

Ruben Geert van den Berg
Dear Mario,
 
Try this. You'll have to adjust the CD and GET FILE commands and make sure that the data are in the right place at the right time ;-)
And make sure that user missing values have been specified as MISSING.
It doesn't work for string variables, however.
 
***SPSS syntax.
 
DATAS CLO ALL.
 
CD '\\Fs03\a1500\PROJECT\Models&Methods\Ruben_apr_09\Projects\Jun_09\P_51'.
 
SET TVA NAM.
 
GET FIL 'C674101_0.SAV'.
 
DATAS NAM Data.
 
* OMS.
DATASET DECLARE Desc.
OMS
/SELECT TABLES
/IF COMMANDS = ["Descriptives"]
SUBTYPES = ["Descriptive Statistics"]
/DESTINATION FORMAT = SAV NUMBERED = TableNumber_
OUTFILE = Desc
VIEWER = NO
/TAG = "Desc".
 
DES ALL.
 
OMSEND TAG=['Desc'].
 
DATAS ACT Desc.
 
SEL IF N=0 AND Var1 NE 'Valid N (listwise)'.
EXE.
 
STR Sps (A100).
COMP Sps=CON("DEL VAR ",RTRIM(Var1),".").
EXE.
 
SAV TRA OUT 'Del_vars.sps'
/TYP TAB
/KEE SPS
/REP.
 
DATAS ACT Data.
 
INS FIL='Del_vars.sps'.
 
 
 




 



 

Date: Tue, 9 Jun 2009 11:51:49 +0000
From: [hidden email]
Subject: Autodelete empty variables?
To: [hidden email]

Hello all,
 
is there a quick way in a huge database to delete all variables that are SYSMIS or MISSING without looking for them?
 
Thanks for any help.
Mario



Express yourself instantly with MSN Messenger! MSN Messenger
Reply | Threaded
Open this post in threaded view
|

Re: Autodelete empty variables?

Albert-Jan Roskam
In reply to this post by Mario Giesel
Hi!

These two lines of Python code work for both string and numerical vars:

import spssaux2
spssaux2.FindEmptyVars(delete=True)

Cheers!!
Albert-Jan

--- On Tue, 6/9/09, Ruben van den Berg <[hidden email]> wrote:

> From: Ruben van den Berg <[hidden email]>
> Subject: Re: Autodelete empty variables?
> To: [hidden email]
> Date: Tuesday, June 9, 2009, 2:16 PM
>
>
>
> #yiv1247139773 .hmmessage P
> {
> margin:0px;padding:0px;}
> #yiv1247139773 {
> font-size:10pt;font-family:Verdana;}
>
>
>
> Dear Mario,
>
>
>
> Try this. You'll have to adjust the CD and GET FILE
> commands and make sure that the data are in the right place
> at the right time ;-)
>
> And make sure that user missing values have been specified
> as MISSING.
>
> It doesn't work for string variables, however.
>
>
>
> ***SPSS syntax.
>
>
>
> DATAS CLO ALL.
>
>
>
> CD
> '\\Fs03\a1500\PROJECT\Models&Methods\Ruben_apr_09\Projects\Jun_09\P_51'.
>
>
>
> SET TVA NAM.
>
>
>
> GET FIL 'C674101_0.SAV'.
>
>
>
> DATAS NAM Data.
>
>
>
> * OMS.
>
> DATASET DECLARE Desc.
>
> OMS
>
> /SELECT TABLES
>
> /IF COMMANDS = ["Descriptives"]
>
> SUBTYPES = ["Descriptive Statistics"]
>
> /DESTINATION FORMAT = SAV NUMBERED = TableNumber_
>
> OUTFILE = Desc
>
> VIEWER = NO
>
> /TAG = "Desc".
>
>
>
> DES ALL.
>
>
>
> OMSEND TAG=['Desc'].
>
>
>
> DATAS ACT Desc.
>
>
>
> SEL IF N=0 AND Var1 NE 'Valid N (listwise)'.
>
> EXE.
>
>
>
> STR Sps (A100).
>
> COMP Sps=CON("DEL VAR
> ",RTRIM(Var1),".").
>
> EXE.
>
>
>
> SAV TRA OUT 'Del_vars.sps'
>
> /TYP TAB
>
> /KEE SPS
>
> /REP.
>
>
>
> DATAS ACT Data.
>
>
>
> INS FIL='Del_vars.sps'.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Date: Tue, 9 Jun 2009 11:51:49 +0000
> From: [hidden email]
> Subject: Autodelete empty variables?
> To: [hidden email]
>
>
>
> #yiv1247139773 .ExternalClass DIV
> {}
>
>
>
> Hello all,
>
> is there a quick way in a huge database to delete all
> variables that are SYSMIS or MISSING without
> looking for them?
>
> Thanks for any help.
> Mario
>
> Express yourself instantly with MSN Messenger!
> MSN
> Messenger
>

=====================
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