Proc export giving additional quotes to the quoted char values.and if u use data step for that it is giving a space or . To numeric values which is not required . Needs to change nothing.now it is , , but want ,, no space no .for missing numeric value.
... View more
Hi, I have a dataset where the year goes from [2000,2015] where I have these countries: Spain, France, Denmark and European Union and let's say two colomns; company='A' and 'B' and value='dollar' Q1: if Spain for company A have average vaule 0.288 Denmark also France also for aaaalll of the 15 years. BUT! We have EU (recall, France, Spain, Denmark are all in European Union (EU)) and for one (1) year EU have the avarage for the same company A, have tha average vaule at 1,000 Q2: For company B;, France, Spain, Denmark and European Union (EU)) have data from [2000,2015] and have ~the same avarage all the four, how to solve that issue besT?
... View more
The fact that I even have to post this tells u what kind of day I'm having 😞 If the HLT_ALZDEM variable doesn't have a valid value of 1 or 2 (yes/no), then the variables that are constructed based on HLT_ALZDEM should be given a value of missing. However, they sometimes are given a value of 0 instead.
Below is a portion of the output file, sorted for rows where HLT_ALZDEM is missing. Since missing is clearly not 1 or 2, all ADRD_group and non_ADRD_group values should also be missing. But they're not. Obs 9 and 10 are identical except for these 2 variables., when Obs 9 is missing and Obs 10 is 0 for both.
The only possible explanation I can think of is that there are non-printable characters for some values of HLT_ALZDEM. But even if there are, those non-printable characters are not 1 or 2. Frequencies for HLT_ALZDEM only show values of 1, 2, and missing.
IF cohort_flag = 1 AND ADM_MA_FLAG_YR = 3
THEN MA_group = 1; ELSE MA_group = 0;
IF cohort_flag = 0 THEN MA_group = .;
IF cohort_flag = 1 AND ADM_FFS_FLAG_YR = 3
THEN TM_group = 1; ELSE TM_group = 0;
IF cohort_flag = 0 THEN TM_group = .;
IF cohort_flag = 1 AND HLT_ALZDEM = 1
THEN ADRD_group = 1; ELSE ADRD_group = 0;
IF cohort_flag = 0 THEN ADRD_group = .;
IF HLT_ALZDEM ^in (1,2) THEN ADRD_group = .;
IF cohort_flag = 1 AND HLT_ALZDEM = 2
THEN non_ADRD_group = 1; ELSE non_ADRD_group = 0;
IF cohort_flag = 0 THEN non_ADRD_group = .;
IF HLT_ALZDEM ^in (1,2) THEN non_ADRD_group = .;
Obs
HLT_ALZDEM
cohort_flag
MA_group
TM_group
ADRD_group
non_ADRD_group
1
0
2
1
0
1
0
0
3
1
1
0
4
0
5
0
6
1
0
1
7
1
1
0
8
1
1
0
9
1
1
0
10
1
1
0
0
0
11
1
1
0
12
1
0
1
13
1
0
1
14
1
0
1
15
1
0
1
16
1
0
1
0
0
... View more
Hi guys,
suppose to have the following:
data DB1;
input ID Index_date Code Admission Discharge Status Date;
format Admission Discharge date9.;
cards;
0001 1 49121 11JAN2018 07FEB2018 Died .
0001 1 4660 11JAN2018 07FEB2018 Died .
0001 0 4821 23MAY2021 21JUN2021 Died .
0002 1 4660 01OCT2017 10OCT2017 Died .
0003 1 4659 30MAY2017 7JUN2017 Died .
0003 0 4659 01JAN2018 10JAN2018 Died .
0004 1 V0182 11NOV2021 17NOV2021 Died .
0004 1 V0182 11NOV2021 17NOV2021 Died .
0004 1 4829 11NOV2021 17NOV2021 Died .
;
data DB2;
input ID Index_date Code Admission Discharge Status Date;
format Admission Discharge date9.;
cards;
0001 1 49121 11JAN2018 07FEB2018 Died 22JUN2021
0001 1 4660 11JAN2018 07FEB2018 Died 22JUN2021
0001 0 4821 23MAY2021 21JUN2021 . .
0002 1 4660 01OCT2017 10OCT2017 Died 11OCT2017
0003 1 4659 30MAY2017 07JUN2017 Died 11JAN2018
0003 0 4659 01JAN2018 10JAN2018 . .
0004 1 V0182 11NOV2021 17NOV2021 Died 18NOV2021
0004 1 V0182 11NOV2021 17NOV2021 Died 18NOV2021
0004 1 4829 11NOV2021 17NOV2021 Died 18NOV2021
;
The desired output id DB2.
I would like to assign the death date as the day after the last recorded discharge date for each ID. It could happen that there is only one Admission-Discharge date for a patient like for ID = 002. Doesn't matter. It could also happen that the Admission-Discharge date is repeated equally (es: ID: 004). This happens because of different recorded codes. Doesn't matter. The death date should be the first day after the last (and repeated) discharge date. Patients are sorted by ID and Admission date. Note that there is also an Index_date that indicate the first admission for that patient.
Finally the format of the table DB2 should be changed with respect to DB1. The death date and the word "Died" should be added to the row where Index_date = 1.
Can anyone help me please?
Thank you in advance
... View more
I have a data set contains DMRN, last visit date, the presence of UI, and recorded date of UI.
DMRN
last_visit
UI
recorded_time
31
26AUG2021
0
06APR2018
31
26AUG2021
0
16JAN2020
31
26AUG2021
1
4MAY2021
33
24MAY2022
0
02MAR2020
33
24MAY2022
0
24MAY2022
35
01DEC2014
0
25MAR2013
I would like to create new_date for each DMRN based on these conditions: if UI = 1 then new_date = recorded_time else if UI = 0 then new_date = last_visit The outcome would be like as follow:
DMRN
last_visit
UI
recorded_time
new_date
31
26AUG2021
0
06APR2018
4MAY2021
31
26AUG2021
0
16JAN2020
4MAY2021
31
26AUG2021
1
4MAY2021
4MAY2021
33
24MAY2022
0
02MAR2020
24MAY2022
33
24MAY2022
0
24MAY2022
24MAY2022
35
01DEC2014
0
25MAR2013
01DEC2014
Could you please help me with the code? Thank you very much
... View more