Please, I need help creating a single categorical variables from several categorical variables. The categorical variables from which I would like to create a single variable are Agitation(1, 0), Akathisia(1, 0), Anxiety_Depression(1, 0), Arrhythmia(1, 0), Cough(1, 0), Dizziness(1, 0), Home_medication(1, 0), Other(1, 0), Pain(1, 0), Psychosis(1, 0), Secretion(1, 0) and High_Bld_Pressure(1, 0). They are mutually exclusive. I would like to create a variable called indication that will have the disease name as observation eg(Agitiation, Cough, Dizziness etc). The code I have below seems to exclude some observation.
Data long232c;
set long232b;
if Agitation=1 then Indication='Agitation';
if Akathisia=1 then Indication='Akathisia';
if Anxiety_Depression=1 then Indication='Anxiety_Dep';
if Arrhythmia=1 then Indication='Arrhythmia';
if Cough=1 then Indication='Cough';
if Dizziness=1 then Indication='Dizziness';
if Fever=1 then Indication='Fever';
if High_Bld_Pressure=1 then Indication='HBP';
if Home_medication ne . and Home_medication=1 then Indication='Home_med';
if Nausea_Vomiting=1 then Indication='Nausea_Vom';
if Other= 1 then Indication='Other';
if Pain=1 then Indication='Pain';
if Psychosis=1 then Indication='Psychosis';
if Secretion=1 then Indication='Secretion';
if Seizure=1 then Indication='Seizure';
if Sleep_disturbance=1 then Indication='Sleep_dist';
if Shortness_of_breath=1 then Indication='SOB';
if Spasm=1 then Indication='Spasm';
if Swelling=1 then Indication='Swelling';
if Withdrawal=1 then Indication='Withdrawal';run;
proc freq data=long232c;
table Indication Agitation Akathisia Anxiety_Depression Arrhythmia Cough Dizziness Home_medication Other Pain Psychosis Secretion High_Bld_Pressure;run;
Thank you
... View more