04-07-2017 11:55 AM
There are many patid's in my data sets. Each patid contains many rows. comment where the value is missing like in the posted one (attachment).
2 lbnam's are grouped into one but some lbnames not.
output should be based on patid, visit and lbnam
sample data: and please find attachment for output sholud look like ..
04-07-2017 03:55 PM
I think that the following does what you want:
data want (drop=counter nmiss); do until (last.group); set have; by PatID Visit Group notsorted; if first.Group then do; counter=1; nmiss=0; end; else counter+1; if missing(value) then nmiss+1; end; do until (last.group); set have; by PatID Visit Group notsorted; if nmiss gt 0 and not missing(group)then do; if counter eq nmiss and counter gt 1 then comment='Y'; else comment='N'; end; output; end; run;
Art, CEO, AnalystFinder.com