Date: Mon, 20 Aug 2007 12:07:39 -0400
Reply-To: Jack Clark <JClark@CHPDM.UMBC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jack Clark <JClark@CHPDM.UMBC.EDU>
Subject: Re: SAS Datastep Help
Content-Type: text/plain; charset="us-ascii"
The first suggestion I would make is to avoid using the word DATA as a
That being said, have you looked at your log? Are there any errors,
warnings or notes that may give you a clue?
Is the variable YEAR character or numeric? If you are not sure, run a
PROC CONTENTS and let us know. If it is numeric, you should not need
the quotes. If it is character, you will need quotes.
Here is one example:
If year = '2006' then delete; * character version ;
If year = 2006 then delete; * numeric version ;
Proc freq data = need;
Tables year / missing;
Try this logic and see if it works.
Center for Health Program Development and Management
University of Maryland, Baltimore County
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Monday, August 20, 2007 11:31 AM
Subject: SAS Datastep Help
To anyone who can help,
I have been attempting run the datastep below, and it will not drop
subjects with year=2006???
IF YEAR NE 2006 THEN OUTPUT;
I have tried several different ways of approaching the problem (using
ne 2006, putting 2006 in quotes- even though it is formatted as numeric,
creating a new var that equals 1 if year =2006, else equals 0 and using
this new var in the output statement, etc.).
Does anyone have any suggestions as to why this code may not be leading
the desired outcome, or how to overcome the problem??? I have looked in
my SAS books, and racked my brain, but I cannot come up with why this
not be working, let alone a solution.