data test; input zone $ state$ brnch$ sales; cards; SOUTH AP VZG 254 SOUTH AP TRP 247 SOUTH AP GUN 321 SOUTH TS HYD 147 SOUTH TS WGL 315 NORTH MH MUM 254 NORTH MH PUN 247 NORTH GJ AHM 323 NORTH DL NCR 148 NORTH DL NOD 319 ; q1)how to create macro variable for zone distinct count Ans: 2 q2)how to create macro variable for distinct values of zone Ans: zone1: SOUTH ZONE2: NORTH i have tried below program for creationl of macro variables for zone .... proc sql; select count(distinct(zone)) into:zone_count from test ; select distinct(zone)into:zone1-:zone%left(&zone_count) from test; quit; --------------------; q3)how to create macro variable for distinct count of state with in zone Ans: SOUTH_state_1: AP SOUTH_state_2: TS NORTH _state_1: MH NORTH _state_2: GJ NORTH _state_3 DL i have tried below program for creationl of macro variables for state with zone .... %macro loop; %do i=1 %to &zone_count ; %global &&zone&i%left(1); proc sql; select STATE,count(distinct(state)) into:&&zone&i%left(1) from test where zone="&&zone&i"; quit; %end; %mend; but the above program is not working.... please help how to create separate macro variables
... View more