Date: Mon, 22 May 2006 13:39:34 -0400
Reply-To: "Rickards, Clinton (GE Consumer Finance)"
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Rickards, Clinton (GE Consumer Finance)"
Subject: Re: Finding observation # associated with a value
Content-Type: text/plain; charset="iso-8859-1"
To answer your specific question, this should do:
if x="usable" then
put "first usable row is " _n_;
call symput("usable_row",put(_n_, 9.));
But a better solution might be to use a where data set option:
set pauls_data (where=(x="usable"));
--- more sas code ---
Your approach has the advantage of launching directly to the row you want but is advantageous only if your data is static. the Where option cuts down on some of the IO.
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Paul
Sent: Monday, May 22, 2006 1:14 PM
Subject: Finding observation # associated with a value
I have a large data set that looks something like this:
I'd like to know which observation is the first one with X="usable" so
that I don't have to waste time reading the observations with
X="garbage". For example, if the first 10,000 lines are garbage, I can
save time by using the subset mydata (firstobs=10001).
Any suggestions most appreciated.