LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (January 2002, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 28 Jan 2002 16:50:23 -0500
Reply-To:     Boyd Newlin <bnewlin@INSMED.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Boyd Newlin <bnewlin@INSMED.COM>
Subject:      Re: deleting duplicates
Comments: To: Yvette <hollied@OLIN.WUSTL.EDU>
Content-Type: text/plain; charset="iso-8859-1"

Yvette,

If I understand you correctly, you want to place missing values in varA if it's a duplicate id year?

If so, this should work.

proc sort data=x; by id year; run;

data y; set x; by id year;

if not first.year then varA='.'; run;

This will place a missing value in varA for every duplicate record of id and year.

HTH

Boyd Newlin Senior Programmer Analyst Insmed Incorporated Biostatistics and Programming P.O. Box 2400 Glen Allen, VA 23058 804-565.3040 fax 804-565.3511 bnewlin@insmed.com

-----Original Message----- From: Yvette [mailto:hollied@OLIN.WUSTL.EDU] Sent: Monday, January 28, 2002 1:00 PM Subject: deleting duplicates

Hello all,

I am tryin to write a line (or two) of code that will allow my data to read if if this observation minus the next observation does not equal zero then put a '.' Although I haven't been very successful.

I tried the if first.year command but it put missing variables for all of my data beyond the first year. I want it to perform this function by both ID and year - by this I mean I won't it to put a missing value when not the first obs for the firm and year.

For example:

if not first.year for 1990 1991 and 1992 then put varA = '.'

I realixe the syntax is not correct but this is what I am trying to get at.

Any help would be greatly appreciated.


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