data flowers ; infile 'd:\sasdata\st404\newiris.dat' firstobs = 2 end = eof ; input group sl sw pl pw ; retain n1 n2 n3 n4 0. ; if group = 1 then n1 = n1 + 1 ; if group = 2 then n2 = n2 + 1 ; if group = 3 then n3 = n3 + 1 ; if group = 4 then n4 = n4 + 1 ; if eof = 1 then do ; total = n1 +n2 +n3 +n4 ; p1 = n1/total ; p2 = n2/total ; p3 = n3/total ; p4 = n4/total ; file print notitles ; put ///// @30 'Iris proportion report' //// @21 'The proportion of irises in group 1 = ' p1 4.3 // @21 'The proportion of irises in group 2 = ' p2 4.3 // @21 'The proportion of irises in group 3 = ' p3 4.3 // @21 'The proportion of irises in group 4 = ' p4 4.3 //// @22 'Based on data collected over 70 years ago' ; end ; run ; proc print ; run ; data some ; infile 'd:\sasdata\st404\newiris.dat' firstobs = 2 end = eof ; input group sl sw pl pw ; retain n1 n2 0. ; if group = 1 or group = 4 ; if group = 1 then n1 = n1 + 1 ; else n2 = n2 + 1 ; if eof = 1 then do ; total = n1 +n2 ; p1 = n1/total ; p2 = n2/total ; file print notitles ; put ///// @25 'Iris subset proportion report' //// @21 'The proportion of irises in group 1 = ' p1 4.3 // @21 'The proportion of irises in group 2 = ' p2 4.3 //// @22 'Based on data collected over 70 years ago' ; end ; run ; proc print ; run ;