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 (June 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 2 Jun 2006 11:45:26 -0700
Reply-To:     "Schwarz, Barry A" <>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Schwarz, Barry A" <>
Subject:      Re: First.Variable
In-Reply-To:  <>
Content-Type: text/plain; charset="us-ascii"

Your code references a variable dai which does not exist in your data set. Is it supposed to be the same as diap? (I assume patinet and relday are just typos.)

When you say all the variables except reldays, does that include Lvacl? Your sample seems to imply the Lvacl is not a player in the decision process.

Can reldays have a value other than 1 or 2? If so, do you want to keep only the 1 or all that not 2?

Your code does not do what you ask since first will be set to one every time reldays changes, even if it is from 1 to 2.

If the answers to the above are yes, no, no, and N/A, respectively, then the following should eliminate all 2s preceded by a 1 but keep any 2s which are unique. It will also eliminate any duplicate 1s and 2s.

PROC SORT DATA = ecg; BY patient sasname dai reldays; RUN;

DATA ecg_new; SET ecg; BY patient sasname dai; IF FIRST.dai; /*implies first.patient and first.sasname also*/ RUN;

If you want to keep duplicate 1s, change the if to IF FIRST.dai OR reldays NE 2;

-----Original Message----- From: Rathindronath [mailto:mehedisas@YAHOO.COM] Sent: Friday, June 02, 2006 7:16 AM To: SAS-L@LISTSERV.UGA.EDU Subject: First.Variable

I have a dataset like the following:

sasname patinet reldays diap Lvacl

QTC 000152 1 Day 1, HR 1 83 QT 000151 2 Dat2 74 HTRATE 000751 1 Day 1, HR 0 75 HTRATE 000751 2 Day 1, HR 0 79

I need a dataset as follow:

sasname patinet reldays diap Lvacl

QTC 000152 1 Day 1, HR 1 83 QT 000151 2 Dat2 74 HTRATE 000751 1 Day 1, HR 0 75

Note: when valus for all the variables (Other than the variable Reldays) are same for two or More observations The observation with the value of 2 for the the variable Relday will be deleted.

I tried the following way, But sure it is not working:

Proc sort data = ECG; BY patient sasname dai relday; Run;

Data ECG; Set ECG; BY patient sasname dai relday; If first.relday = 1; Run;

Can anyone be kind enough to help me out this?

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