Create a new variable called disease and make it equal to 1 if a person has complaints of heartburns, sickness, and spasm, but no temperature or tiredness. If the person does not have this exact symptom breakdown, make disease equal to 0. Lastly, use PROC FREQ to determine what number and proportion of individuals in the dataset has the disease of interest. I do not know how to do this. Any hints or help? I am studying for an exam and need to understand this program. %macro one (v1,v2);
proc import out = &v1
datafile = "\\Client\C$\Users\jess\Desktop\data\&v2"
DBMS = xlsx replace;
getnames = YES;
run;
%mend one;
%one (Project3, Project3_f17);
proc format;
value symptom_no 1= "heartburns"
2= "Sickness"
3= "Spasm"
4= "Temperature"
5= "Tiredness";
proc sort data=Project3 out= longsort;
by id_no;
run;
data new;
set longsort;
by id_no;
Keep id_no sympt1 - sympt5 disease;
retain sympt1 - sympt5 disease;
disease=0;
array New_a (1:5) $20 sympt1 - sympt5;
If first.id_no then
do;
Do i = 1 to 5;
new_a (i) = .;
end;
end;
new_a (symptom_no) = symptom;
if last.id_no then output;
run;
proc print data= new;
run; This code gives me this... Obs id_no sympt1 sympt2 sympt3 sympt4 sympt5 disease 1 1 Heartburns Sickness 0 2 4 Tiredness 0 3 6 Heartburns 0 4 7 Temperature 0 5 8 Heartburns Tiredness 0 6 9 Sickness Spasm Temperature 0 7 10 Spasm Tiredness 0 8 11 Spasm Tiredness 0 9 12 Temperature Tiredness 0 10 13 Spasm Temperature 0 11 14 Spasm 0 12 15 Heartburns Temperature 0 13 16 Tiredness 0 14 17 Heartburns 0 15 19 Sickness 0 Except it does not include the disease column.
... View more