I have the following code which captures 105 of 1400 possible diagnoses: proc sql;
select DISTINCT quote(trim(dsc_diag_1)) INTO :BH_LIST separated by ' , '
from claims1
where (dsc_diag_1 like '% ANXIETY %' OR dsc_diag_1 like '% DEMENTIA %' OR dsc_diag_1 like '% MOOD %' OR dsc_diag_1 like '% SCHIZOPHRENIA %' OR dsc_diag_1 like '%SCHIZO%'
OR dsc_diag_1 like '% DISSOCIATIVE %' OR dsc_diag_1 like '% STRESS %' OR dsc_diag_1 like '% DELUSIONAL %' OR dsc_diag_1 like '% PSYCHOACTIVE %'
OR dsc_diag_1 like '% BEHAVIORAL %' OR dsc_diag_1 like '% MENTAL %' OR dsc_diag_1 like '% PERSONALITY %' OR dsc_diag_1 like '% INTELLECTUAL %'
OR dsc_diag_1 like '% DEVELOPMENTAL %' OR dsc_diag_1 like '% EMOTIONAL %' OR dsc_diag_1 like '% PSYCH %' OR dsc_diag_1 like '% ALCOHOL %'
OR dsc_diag_1 like '% DEPRESSIVE %' OR dsc_diag_1 like '% DEPRESSION %' OR dsc_diag_1 like '% NEURO %' OR dsc_diag_1 like '% DELUSION %'
OR dsc_diag_1 like '% CANNABIS ABUSE%' OR dsc_diag_1 like '% CANNABIS USE%' OR dsc_diag_1 like '% CANNABIS DEPENDENCE%'
OR dsc_diag_1 like '% SEDATIVE, %' OR dsc_diag_1 like '% COCAINE %' OR dsc_diag_1 like '% NICOTINE %'
OR dsc_diag_1 like '% INHALANT %' OR dsc_diag_1 like '% STIMULANT %' OR dsc_diag_1 like '% SCHIZOAFFECTIVE %' OR dsc_diag_1 like '% PSYCHOSIS %'
OR dsc_diag_1 like '% BIPOLAR %' OR dsc_diag_1 like '% DEPRESS %' OR dsc_diag_1 like '% CYCLOTHYMIC %' OR dsc_diag_1 like '% DYSTHIMIC %'
OR dsc_diag_1 like '% PANIC %' OR dsc_diag_1 like '% ADJUSTMENT DISORDER %' OR dsc_diag_1 like '% POST-TRAUMATIC STRESS %' OR dsc_diag_1 like '% SOMATOFORM %'
OR dsc_diag_1 like '% ANTISOCIAL %' OR dsc_diag_1 like '% BORDERLINE PERSONALITY %' OR dsc_diag_1 like '% EXPLOSIVE %' OR dsc_diag_1 like '% IMPULSE %'
OR dsc_diag_1 like '% HYPERACTIVITY %' OR dsc_diag_1 like '% CONDUCT %' OR dsc_diag_1 like '% BEHAV/EMOTN %' OR dsc_diag_1 like '% IMPULSE %')
and dsc_diag_1 not like '% OPIOID %' and dsc_diag_1 not like '% REMISSION %';
quit; I am having trouble for some reason creating the compliment of this code, which would create a list of the other 1295 diagnoses codes. I cannot tell if my code is working, and the macro list is too long so the code stops running, or if my code is wrong altogether. I have tried a few variations on the following: proc sql;
select DISTINCT quote(trim(dsc_diag_1)) INTO :PH_LIST separated by ' , '
from claims1
where dsc_diag_1 not like '% ANXIETY %' and dsc_diag_1 not like '% DEMENTIA %' and dsc_diag_1 not like '% MOOD %' and dsc_diag_1 not like '% SCHIZOPHRENIA %'
or dsc_diag_1 not like '% SCHIZO %' and dsc_diag_1 not like '% SEDATIVE, %' and dsc_diag_1 not like '% COCAINE %' and dsc_diag_1 not like '% NICOTINE %'
or dsc_diag_1 not like '% DISSOCIATIVE %' and dsc_diag_1 not like '% DELUSIONAL %' and dsc_diag_1 not like '% PSYCHOACTIVE %'
or dsc_diag_1 not like '% BEHAVIORAL %' and dsc_diag_1 not like '% MENTAL %' and dsc_diag_1 not like '% PERSONALITY %' and dsc_diag_1 not like '% INTELLECTUAL %'
or dsc_diag_1 not like '% DEVELOPMENTAL %' and dsc_diag_1 not like '% EMOTIONAL %' and dsc_diag_1 not like '% PSYCH %' and dsc_diag_1 not like '% ALCOHOL %'
or dsc_diag_1 not like '% DEPRESSIVE %' and dsc_diag_1 not like '% DEPRESSION %' and dsc_diag_1 not like '% NEURO %' and dsc_diag_1 not like '% DELUSION %'
or dsc_diag_1 not like '% CANNABIS ABUSE%' and dsc_diag_1 not like '% CANNABIS USE%' and dsc_diag_1 not like '% CANNABIS DEPENDENCE %'
or dsc_diag_1 not like '% INHALANT %' and dsc_diag_1 not like '% STIMULANT %' and dsc_diag_1 not like '% SCHIZOAFFECTIVE %' and dsc_diag_1 not like '% PSYCHOSIS %'
or dsc_diag_1 not like '% BIPOLAR %' and dsc_diag_1 not like '% DEPRESS %' and dsc_diag_1 not like '% CYCLOTHYMIC %' and dsc_diag_1 not like '% DYSTHIMIC %'
or dsc_diag_1 not like '% PANIC %' and dsc_diag_1 not like '% ADJUSTMENT DISORDER %' and dsc_diag_1 not like '% POST-TRAUMATIC STRESS %' and dsc_diag_1 not like '% SOMATOFORM %'
or dsc_diag_1 not like '% ANTISOCIAL %' and dsc_diag_1 not like '% BORDERLINE PERSONALITY %' and dsc_diag_1 not like '% EXPLOSIVE %' and dsc_diag_1 not like '% IMPULSE %'
or dsc_diag_1 not like '% HYPERACTIVITY %' and dsc_diag_1 not like '% CONDUCT %' and dsc_diag_1 not like '% BEHAV/EMOTN %' and dsc_diag_1 not like '% IMPULSE %'
or dsc_diag_1 not like '% OPIOID %' and dsc_diag_1 not like '% REMISSION %';
quit; Thank you for your time, Barrett
... View more