cfa2012 发表于 2013-12-3 20:18 
我那上面写的do 和end是匹配的吧!
不好意思刚才看错了。datalines语句必须是data步中的最后一个语句,并把#改成$就应该行了。
if sbp lt 140 then sbpgroup='Low';
else ssbpgroup='High';
end;
这里的 else ssbpgroup='High';是不是要改成 else sbpgroup='High';
data vitals;
input ID : $3.
Age
Pulse
SBP
DBP;
label SBP = "Systolic Blood Pressure"
DBP = "Diastolic Blood Pressure";
if missing(age) then delete;
if age lt 50 then do;
if pulse lt 70 then pulsegroup='Low';
else pulsegroup='High';
if sbp lt 130 then sbpgroup='Low';
else sbpgroup='High';
end;
else if age ge 50 then do;
if pulse lt 74 then pulsegroup='Low';
else pulsegroup='High';
if sbp lt 140 then sbpgroup='Low';
else sbpgroup='High';
end;
datalines;
001 23 68 120 80
002 55 72 188 96
003 78 82 200 100
004 18 58 110 70
005 43 52 120 82
006 37 74 150 98
007 . 82 140 100
;
run;