LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 20 May 2010 08:59:12 -0700
Reply-To:     "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: How to delete observations with all variables missing?
In-Reply-To:  <>
Content-Type: text/plain; charset=utf-8

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Data _null_; > Sent: Thursday, May 20, 2010 8:37 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: How to delete observations with all variables missing? > > On 5/20/10, Joe Whitehurst <> wrote: > > Of course, it you wanted the data in a SAS dataset, you would still > have to > > define the variables. But you could avoid defining the variables for > > records with all missing values. > > > > data test; > > infile test > > input; > > if ^missing(_infile_) then input /* variable specifications*/; > > run; > > You're on the right track but this will only work as written when the > line is completely blank. Not the case with the example data where > the missing values are marked with a period. > > if missing(compress(_infile_,'.')) then delete; > > Compressing the periods might be adequate but I'm sure there may be > other scenarios where it would not.

One of those other scenarios would be where the data was delimited (tab, |, comma, etc.). The delimiters will also need to be compressed out in the test. If the data are delimited with '|', one could do something like

/* 5 numeric variables, missing are just missing */ data test; infile "c:\SAS_Examples\test_data.txt" dlm='|' dsd missover; input @; if missing(compress(_infile_, '|')) then delete; input a b c d e; run;

Hope this is helpful,


Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204

Back to: Top of message | Previous page | Main SAS-L page