12-27-2024
tarheel13
Rhodochrosite | Level 12
Member since
12-05-2017
- 593 Posts
- 311 Likes Given
- 39 Solutions
- 136 Likes Received
-
Latest posts by tarheel13
Subject Views Posted 542 11-06-2024 05:18 AM 608 11-05-2024 10:51 PM 648 11-05-2024 08:45 PM 2234 05-12-2024 07:08 AM 684 05-04-2024 10:24 PM 703 05-04-2024 07:20 PM 2358 05-04-2024 06:59 PM 1492 03-09-2024 06:06 PM 1825 03-06-2024 10:39 AM 1829 03-06-2024 10:37 AM -
Activity Feed for tarheel13
- Posted Re: SAS installation is stuck on SAS Programming. 11-06-2024 05:18 AM
- Posted Re: SAS installation is stuck on SAS Programming. 11-05-2024 10:51 PM
- Liked Re: Extracting line from free text that contains a keyword for s_lassen. 11-05-2024 08:46 PM
- Posted SAS installation is stuck on SAS Programming. 11-05-2024 08:45 PM
- Liked Re: Identify and flag the latest day for Patrick. 05-13-2024 10:26 AM
- Liked Re: account verification for kortom01. 05-13-2024 10:25 AM
- Posted Re: Seeking Advice on SAS for Entry into Pharma Industry on New SAS User. 05-12-2024 07:08 AM
- Liked Re: create a new library for Ronein. 05-09-2024 02:13 PM
- Posted Re: Identify death date over a list of dates on New SAS User. 05-04-2024 10:24 PM
- Liked Re: Person-years form a start to an end date for Quentin. 05-04-2024 07:27 PM
- Posted Re: Identify death date over a list of dates on New SAS User. 05-04-2024 07:20 PM
- Liked Re: Interaction plot for Ksharp. 05-04-2024 07:02 PM
- Posted Re: Seeking Advice on SAS for Entry into Pharma Industry on New SAS User. 05-04-2024 06:59 PM
- Liked Re: How do I return the data on nth row of a dataset? for FreelanceReinh. 03-12-2024 09:13 AM
- Liked Re: How to count rows that come after a certain date? for Bumble_15. 03-12-2024 09:12 AM
- Posted Re: How to count rows that come after a certain date? on SAS Programming. 03-09-2024 06:06 PM
- Liked Re: macro within a macro for yabwon. 03-08-2024 08:09 AM
- Liked Re: a question on regular expression for Patrick. 03-07-2024 06:35 AM
- Liked Re: a question on regular expression for Patrick. 03-07-2024 06:34 AM
- Liked Re: Need help to impute NULL with value from the same ID for Patrick. 03-06-2024 01:27 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 1 1 -
My Liked Posts
Subject Likes Posted 1 03-06-2024 10:35 AM 1 03-06-2024 10:39 AM 1 03-04-2024 02:46 PM 1 03-04-2024 02:40 PM 1 01-05-2024 07:17 AM
01-02-2024
09:03 AM
no worries. I gave you new code. Please see if the new screenshot matches your desired output. I did not understand your requirement initially. Apologies.
... View more
01-02-2024
08:58 AM
it seems you want it within ae too, so then just change to if first.ae as such.
data want;
set test;
by usubjid ae;
length rank 8 maxrank 8;
retain rank;
if _n_=1 then do;
declare hash end ();
end.definekey("aendt", "llt");
end.definedata("rank");
end.definedone();
end;
if first.ae then do;
rc=end.clear();
maxrank=1;
rank=1;
rc=end.add();
end;
else do;
if end.find(key:astdt, key:llt) ne 0 then
do;
maxrank + 1;
rank=maxrank;
rc=end.add();
end;
else do;
if end.check() ne 0 then
rc=end.add();
end;
end;
drop rc maxrank;
proc print;
run;
... View more
01-02-2024
08:53 AM
it seems like you are changing the requirements. you were only considering LLT and AE start and end dates previously. so what is the requirement now?
... View more
01-02-2024
07:14 AM
try this. no uninitialized in log now.
data want;
set test;
by usubjid ae;
length rank 8 maxrank 8;
retain rank;
if _n_=1 then do;
declare hash end ();
end.definekey("aendt", "llt");
end.definedata("rank");
end.definedone();
end;
if first.usubjid then do;
rc=end.clear();
maxrank=1;
rank=1;
rc=end.add();
end;
else do;
if end.find(key:astdt, key:llt) ne 0 then
do;
maxrank + 1;
rank=maxrank;
rc=end.add();
end;
else do;
if end.check() ne 0 then
rc=end.add();
end;
end;
drop rc maxrank;
proc print;
run;
... View more
01-01-2024
07:57 PM
you can follow what's in this paper. they have examples of AE tables. https://support.sas.com/resources/papers/proceedings20/4936-2020.pdf
... View more
01-01-2024
02:44 PM
2 Likes
data test;
informat usubjid $3. llt $5. ae $7. astdt date9. aendt date9.;
input usubjid $
ae $
llt $
astdt
aendt
;
format astdt aendt date9.;
datalines;
120 enzymes Lipa 21FEB2020 06MAR2020
120 enzymes Lipa 06MAR2020 13MAR2020
120 enzymes Serum 06MAR2020 13MAR2020
120 enzymes Lipa 09APR2020 21MAY2020
120 enzymes Serum 09APR2020 03JUN2020
120 enzymes Lipa 21MAY2020 01JUL2020
120 enzymes Serum 03JUN2020 01JUL2020
120 enzymes Lipa 01JUL2020 28JUL2020
120 enzymes Serum 01JUL2020 18NOV2020
120 enzymes Lipa 28JUL2020 26AUG2020
120 enzymes Lipa 26AUG2020 21OCT2020
120 enzymes Lipa 18NOV2020 15DEC2020
120 enzymes Amylase 18NOV2020 15DEC2020
120 enzymes Serum 15DEC2020 .
;
proc print;
run;
data want;
set test;
by usubjid ae;
length rank 8 maxrank 8;
retain rank;
if _n_ = 1
then do;
declare hash end ();
end.definekey("aendt","llt");
end.definedata("rank");
end.definedone();
end;
if first.usubjid then rank = 1;
else do;
if first.rank
then do;
rc = end.clear();
maxrank = 1;
rank = 1;
rc = end.add();
end;
else do;
if end.find(key:astdt,key:llt) ne 0
then do;
maxrank + 1;
rank = maxrank;
rc = end.add();
end;
else do;
if end.check() ne 0
then rc = end.add();
end;
end;
end;
drop rc maxrank;
proc print;
run;
Adapting @Kurt_Bremser 's code. shouldn't the last 3 rows be 5,6,7 for rank and not 6,5,7?
... View more
01-01-2024
12:51 PM
you could possibly try the lag function to store the previous end date and previous LLT in new variables.
... View more
01-01-2024
12:20 PM
you could maybe write a macro to do this.
... View more
06-02-2023
07:28 AM
can we please start something for FL? I know I'm not the only SAS user here and FL is a large state.
... View more
05-02-2023
11:37 AM
I find regular expressions are still underused by most SAS programmers. Great solution!
... View more