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 (August 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: Tamarah Smith-Dyer <tfdyer@GMAIL.COM>
In-Reply-To:  A<200708201531.l7KCY4o7012804@malibu.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"

Tamarah,

The first suggestion I would make is to avoid using the word DATA as a dataset name.

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:

Data need; Set have; If year = '2006' then delete; * character version ; If year = 2006 then delete; * numeric version ; Run;

Proc freq data = need; Tables year / missing; Run;

Try this logic and see if it works.

Jack Clark Research Analyst Center for Health Program Development and Management University of Maryland, Baltimore County

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Tamarah Smith-Dyer Sent: Monday, August 20, 2007 11:31 AM To: SAS-L@LISTSERV.UGA.EDU 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???

DATA DATA; SET DATA; IF YEAR NE 2006 THEN OUTPUT; RUN;

I have tried several different ways of approaching the problem (using year 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 to 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 may not be working, let alone a solution.

Much thanks! Tamarah


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