wrote it myself. this is the original one: proc sql; title 'Self Identification by Age Group, HQ Region'; select Band2, count(SI_PRI) as SI_PRI format=comma10., count (PRI)as PRI format=comma10., calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="HQ" title 'Self Identification by Age Group, HQ Region'; group by Band2 union all select 'TOTAL', count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="HQ" ; TITLE; Quit; proc sql; title 'Self Identification by Age Group, Atlantic Region'; select Band2, count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="ATLANTIC" title 'Self Identification by Age Group, Atlantic Region'; group by Band2 union all select 'TOTAL', count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="ATLANTIC" ; TITLE; Quit; proc sql; title 'Self Identification by Age Group, PACIFIC Region'; select Band2, count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="PACIFIC" group by Band2 union all select 'TOTAL', count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="PACIFIC" ; TITLE; Quit; proc sql; title 'Self Identification by Age Group, ONTARIO Region'; select Band2, count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="ONTARIO" group by Band2 union all select 'TOTAL', count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="ONTARIO" ; TITLE; Quit; proc sql; title 'Self Identification by Age Group, PRAIRIES Region'; select Band2, count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="PRAIRIES" group by Band2 union all select 'TOTAL', count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="PRAIRIES" ; TITLE; Quit; proc sql; title 'Self Identification by Age Group, QUEBEC Region'; select Band2, count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="QUEBEC" group by Band2 union all select 'TOTAL', count(SI_PRI) as SI_PRI, count (PRI)as PRI, calculated SI_PRI/calculated PRI "Return rate" format=percent8.1 from work.Si where REGION="QUEBEC" ; TITLE; Quit; but I want o combine all together to make it shorter and more efficient. Thanks, Nazanin
... View more