09-30-2024
abraham1
Obsidian | Level 7
Member since
11-16-2020
- 37 Posts
- 31 Likes Given
- 0 Solutions
- 1 Likes Received
-
Latest posts by abraham1
Subject Views Posted 727 09-26-2024 07:01 AM 817 07-10-2023 08:14 AM 864 07-10-2023 07:24 AM 526 03-05-2023 08:57 PM 1164 03-02-2023 09:21 PM 1182 03-02-2023 08:37 PM 1218 03-02-2023 02:18 PM 1264 03-02-2023 01:15 PM 553 11-25-2022 10:48 AM 5218 11-11-2022 02:55 PM -
Activity Feed for abraham1
- Got a Like for comparing all variable values between two datasets and high-light mismatch. a week ago
- Liked Re: populating previous date not working for rudfaden. 09-29-2024 02:56 AM
- Liked Re: populating previous date not working for rudfaden. 09-29-2024 02:56 AM
- Posted populating previous date not working on SAS Programming. 09-26-2024 07:01 AM
- Posted Re: Compare value between two different columns for entire datasets and calculate overall score on SAS Programming. 07-10-2023 08:14 AM
- Posted Compare value between two different columns for entire datasets and calculate overall score on SAS Programming. 07-10-2023 07:24 AM
- Liked Re: compare visit time among all phases for s_lassen. 03-06-2023 03:34 AM
- Posted compare visit time among all phases on SAS Programming. 03-05-2023 08:57 PM
- Posted Re: Find record with joining time greater than relieving time on SAS Programming. 03-02-2023 09:21 PM
- Liked Re: Find record with joining time greater than relieving time for PaigeMiller. 03-02-2023 09:21 PM
- Liked Re: Find record with joining time greater than relieving time for Kurt_Bremser. 03-02-2023 09:21 PM
- Liked Re: Find record with joining time greater than relieving time for PaigeMiller. 03-02-2023 09:21 PM
- Posted Re: Find record with joining time greater than relieving time on SAS Programming. 03-02-2023 08:37 PM
- Posted Re: Find record with joining time greater than relieving time on SAS Programming. 03-02-2023 02:18 PM
- Posted Find record with joining time greater than relieving time on SAS Programming. 03-02-2023 01:15 PM
- Liked Re: Transpose data for two columns based on two sectors for Tom. 11-25-2022 12:32 PM
- Posted Transpose data for two columns based on two sectors on SAS Programming. 11-25-2022 10:48 AM
- Posted Re: comparing all variable values between two datasets and high-light mismatch on SAS Programming. 11-11-2022 02:55 PM
- Liked Re: comparing all variable values between two datasets and high-light mismatch for Ksharp. 11-11-2022 02:54 PM
- Posted Re: comparing all variable values between two datasets and high-light mismatch on SAS Programming. 11-08-2022 03:56 AM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 1 1 -
My Liked Posts
Subject Likes Posted 1 11-08-2022 01:31 AM
09-26-2024
07:01 AM
Hi,
From below dataset, I want to populate previous date for unique subjid. I use below sas code but it is not working. can you please help me.
I need to populate
1) prev_date as separate column
2)A flag1 column that populate 1 when difference between first visit date and last visit date >25.
2)A flag2 column that populate 1 when difference between first visit and previous visit date >25.
data demon;
input subjid $ visitdate : yymmdd10.;
format visitdate yymmdd10.;
datalines;
111 2024-07-15
111 2024-07-22
111 2024-08-29
222 2024-07-15
222 2024-07-22
333 2024-07-24
333 2024-08-15
333 2024-09-25
;
run;
proc sort data=demon;by subjid visitdate;run;
data demo1;
set demon;
by subjid visitdate;
retain prev_date;
if first.subjid then do;
prev_date = .;
end;
else prev_date = lag(visitdate);
format prev_date yymmdd10.;
run;
... View more
07-10-2023
08:14 AM
Variable are totally different like SOTMIGT with TOSDIGT, DOBINEE~EDTANEE, AIKTNEE~WSTINEE, CHOSTEAD~DEENEAD etc. Most of variable last three letters are same when selected for comparison
... View more
07-10-2023
07:24 AM
Hello Everyone!
In my below datasets, I need to compare between two unique columns (jp1~jp2, eye1~eye2 etc) and calculate value based on condition as if both contain value of 1, then display as 1 else zero.
Once done, sum all the score from derived columns.
In my actual datasets, I have two hundred columns with different name (not end with suffix 1 or 2)
and I need to follow below approach,
Is there any alternative way to program it.
Thank you
data testing;
input pid visit jp1 jp2 eye1 eye2 ear1 ear2 nose1 nose2;
cards;
101 2 1 1 1 1 1 0 0 1
102 3 0 0 1 0 1 1 1 1
102 5 0 0 1 0 1 1 0 0
102 6 1 1 1 1 1 1 1 1
103 4 0 0 0 0 0 0 1 1
104 7 1 1 1 1 1 1 1 0
105 3 . 0 0 . . . . .
;
run;
data comp;
set testing;
by pid visit;
if jp1=1 and jp2 =1 then jp_score=1; else f_score=0;
if eye1=1 and eye2 =1 then eye_score=1 ;else eye_score=0;
if ear1=1 and ear2 =1 then ear_score=1; else ear_score=0;
if nose1=1 and nose2 =1 then nos_score=1; else nos_score=0;
sum_score=sum(f_score,eye_score,ear_score,nos_score);
run;
... View more
03-05-2023
08:57 PM
Hi Everyone!
For my study, I want to retrieve records from all phases when one hour prior to first visit time i.e. visit_F ({HH:MM}-1) is greater than last visit time (HH:MM)
In database, all dates are stored in character format.
data visit;
input phase visit_F $20. visit_E $20.;
cards;
1 2012-04-24T19:22:03 2012-04-24T20:23:03
2 2012-04-22T07:22:03 2012-04-22T07:22:01
3 2012-04-24T19:22:03 2012-04-24T16:23:03
;
run;
... View more
03-02-2023
09:21 PM
Thank you sir as both of you can help me to resolve my query.
... View more
03-02-2023
08:37 PM
I am not getting expected result as I need to compare time in HH:MM between two dates. I have added one more record (103) where time 08:19 >05:11 irrepective of date.
I am expecting this record also to be retrieved along with 101.
data emp;
input id join $20. relieve $20.;
cards;
101 2022-11-24T09:21:04 2022-11-24T11:24:14
102 2022-12-09T07:19:10 2022-12-09T05:19:10
103 2022-12-05T08:19:10 2022-12-09T05:11:10
;
run;
data emp_fixed;
set emp (rename=(join=_join relieve=_relieve));
join = input(_join,e8601dt19.);
relieve = input(_relieve,e8601dt19.);
format join relieve e8601dt19.;
drop _join _relieve;
run;
data emp1;
set emp_fixed;
where join gt relieve;
run;
... View more
03-02-2023
02:18 PM
Thank you sir for the details.
When the dates are stored in character format in dataset, how can this be handled.
I used below code but don't know how to pull data with joining time greater than relieving time. can you please help me one more time.
data emp;
input id join $20. relieve $20.;
cards;
101 2022-11-24T09:21:04 2022-11-24T11:24:14
102 2022-12-09T07:19:10 2022-12-09T05:19:10
;
run;
data emp1;
set emp;
join1= substr(join,12,5);
jointime = timepart( intnx('dthour',input(join1,time5.),0,'same'));
relieve1= substr(relieve,12,5);
relievetime = timepart( intnx('dthour',input(relieve1,time5.),0,'same'));
format jointime relievetime time5.;
run;
... View more
03-02-2023
01:15 PM
Hi All, In my dataset, I want to retrieve only those records where emp joining time (hh:mm) > relieve time (hh:mm)
e.g I am not sure how to import dates into emp dataset. Please check.
data emp;
input id join relieve;
cards;
101 2022-11-24T09:21:04 2022-11-24T11:24:14
102 2022-12-09T07:19:10 2022-12-09T05:19:10
;
run;
data emp1;
set emp;
join1= substr(join,12,5);
jointime = timepart( intnx('dthour',input(join1,time5.),0,'same'));
relieve1= substr(relieve,12,5);
relievetime = timepart( intnx('dthour',input(relieve1,time5.),0,'same'));
format jointime relievetime time5.;
run;
data final;
set emp1;
where jointime>relievetime;
run;
... View more
11-25-2022
10:48 AM
Hi All,
The below test data contain information of two sectors (emea, fda). I want to isolate the datasets for score and event variable based on individual sectors (value for col E-F as 'emea', newly added col G-H as 'fda')
e.g. for record 3, 6,7,8 --> value populated from E-F where as blank for G-H for record 4,5 --> value populated from G-H where as blank for E-F
Can you please help.
data test;
input pid age gender race event2 $ sector $ score;
cards;
101 21 1 1 fever EMEA 25
102 21 2 2 pain FDA 45
103 31 1 3 headac FDA 54
104 43 2 4 joint EMEA 66
105 43 2 5 cold EMEA 100
106 75 2 6 anemia EMEA 232
;
run;
Expected output
... View more
11-11-2022
02:55 PM
Thank you so much sir
... View more
11-08-2022
03:56 AM
I have added one numeric variable ('dose'). please have a look.
The discrepancy in last variable if found during comparison will be added into comment column. I have not updated the final output. Hope it is fine.
data phase1;
input PID AGE Visit phase event $ drug $ study $ dose;
cards;
101 23 1 1 asthma parace Yes 5
102 32 1 1 asthma sinarest Yes 10
101 23 2 1 headache drg1 No 5
103 43 1 1 vomit drg4 Yes 5
103 43 2 1 pain drg5 No 100
103 43 3 1 pain drg5 Yes 500
;
run;
data phase2;
input PID AGE Visit phase event $ drug $ study $ dose;
cards;
101 23 1 2 asthma parace Yes 5
102 32 1 2 asthma . Yes 5
101 23 2 2 acidity drg1 No 5
103 43 1 2 vomit drg4 Yes 100
103 43 2 2 pain drg5 No 100
103 43 4 2 pan drg5 Yes 500
107 43 3 2 pain drg5 Yes 200
;
run;
proc sort data=phase1;by pid visit phase;run;
proc sort data=phase2;by pid visit phase;run;
proc sql;
create table final as
select * from phase1 union all
select * from phase2;
run;
... View more
11-08-2022
03:12 AM
Thank you sir for checking
As I need to compare new dataset i.e. phase 2 to phase 1 (master sheet), the comment column should display discrepancy only on new dataset. Therefore phase 1 comment column kept blank
I need to generate the report in excel format for analysis.
No, some variables contain values of numeric, some character and some alphanumeric.
... View more
11-08-2022
01:31 AM
1 Like
Hi everyone
I have two datasets from phase I and phase 2 trials. I need to combine the data and compare each variable value from phase2 to each variable from phase 1 and high-light all mismatch value with red color.
Along with this, a new column needs to be inserted ' comment' where if data are matching, it should populate 'matching'. For every mismatch, it will display which variable mismatch and the respective value in parenthesis. Multiple mismatches should be separated by comma.
I need to repeat the same process for 500 variables and lakh of records in new dataset
data phase1;
input PID AGE Visit phase event $ drug $ study $;
cards;
101 23 1 1 asthma parace Yes
102 32 1 1 asthma sinarest Yes
101 23 2 1 headache drg1 No
103 43 1 1 vomit drg4 Yes
103 43 2 1 pain drg5 No
103 43 3 1 pain drg5 Yes
;
run;
data phase2;
input PID AGE Visit phase event $ drug $ study $;
cards;
101 23 1 2 asthma parace Yes
102 32 1 2 asthma . Yes
101 23 2 2 acidity drg1 No
103 43 1 2 vomit drg4 Yes
103 43 2 2 pain drg5 No
103 43 4 2 pan drg5 Yes
107 43 3 2 pain drg5 Yes
;
run;
proc sort data=phase1;by pid visit phase;run;
proc sort data=phase2;by pid visit phase;run;
proc sql;
create table final as
select * from phase1 union all
select * from phase2;
run;
Output
... View more
10-18-2022
09:41 PM
I have just added sample data for reporting. I need to export the output to excel file with ods tagset excelxp option with column header to be displayed in vertical format.
... View more
10-18-2022
05:30 AM
Hi,
I am getting error while running the below code in log file.
Unrecognized option: ROTATE_HEADERS Unrecognized option: HEIGHT
I want to change the column header from horizontal to vertical format. Also all the columns should contain constant height of 10 and width of 7.
Can you please help
data test;
input pid age gender race event2 $;
label
pid = 'Patient ID'
age = 'Patient age'
gender='Sex'
race = 'Race'
event2='Event 2'
;
cards;
101 21 1 1 fever
102 21 2 1 fever
103 31 1 1 fever
104 43 2 1 fever
;
ods tagsets.excelxp file='D:/outputs/test.xls' style=normal
options( rotate_headers="45"
height="60");
proc print data=test ; run;
ods tagsets.excelxp close;
me
... View more