Dave,
1.
SAS can in fact use indexes. To apply an
index to a data set use the
proc datasets lib=yourlib;
modify
yourdataset;
index create
varname;
index create
compositename = (var1 var2 ...);
quit;
2.
use the proc means procedure using a by or class
statement.
Since you don't indicate a Patient ID in your
example you would use name as the by or class variable.
proc means data=yourdataset;
by name;
var start end;
output out=means min=min_start min_end
max=max_start max_end;
run;
This will generate a min value for start and end as
well as a max value for start and end by the name variable.
If you use the by statement, your data set will
either have to be indexed or sorted by the BY variable.
If you use the class statement, you don't have to
index or sort.
3.
I'll leave this to others.
Richard Graham
Glencairn Consulting Group
----- Original Message -----
Sent: Monday, January 21, 2002 1:50 PM
Subject: collapsing records and
indexing
> Hi everyone,
>
> New SAS programmer Dave (6 months - "I
am but an egg") with a couple of
> quick questions for you SAS geniuses
out there:
>
> 1) My boss (an MD) was asking me if SAS had indexing
capability like
> Access does (he is interested in run times for some of
the ouput I have
> been getting him - they are big files and it sometimes
takes me multiple
> hours to complete the run) - I told him that I wasn't
sure off hand, but
> that I was sure that either: a) SAS does, or b) it
has something better
> (smile) - Did I lie?? I have just started to
look through my books and
> the on-line documentation - any ideas anyone
has will be appreciated.
>
> 2) I have just hit what is my
trickiest problem to far with SAS - I need
> have to collapse line item
(record level) transaction items and return
> the member specific earliest
"start date" and latest "end date" along
> with the detail that is
identical from line to line -
>
> Data example:
>
>
MEMBER START
DATE END DATE
DOB
> John Q
15280
15283 -3287
> John
Q
15280
15284 -3287
> John
Q
15278
15280 -3287
>
>
> So really John Q was in the hospital from 15278 to 15284 (6 days)
and
> had 3 doc's billing for different services over the time - - so I
am
> trying to be able to return the following:
>
>
MEMBER START
DATE END DATE
DOB
> John Q
15278
15284 -3287
>
> Any
suggestions anyone?
>
> 3) I have decided that if I am going to be
serious about joining the SAS
> cult, that I should plan to go to SUGI in
FL - - Does anyone have any
> advice for a guy going to their first SAS
conference - any types of
> sessions help anyone out more then
others...etc??? I am looking forward
> to it.
>
>
Thanks everyone - Dave
>
>
>
>
> --
>
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
>