Hi, I am trying to convert this if/then statements into nested case when statements. I am using Proc SLQ as supposed to sas datastep because I want to do group by and sum functions. I understand that datasteps can perform similar task but I want to use proc sql for this particular job. My code looks like below Data temp; Length Rank_rng $7.; Set population_a; If city_code = 100 then do; If Rank_100 in (1,2,3) then Rank_rng = '1_3'; else if Rank_100 in (4,5,6) then Rank_rng = '4_6'; else if Rank_100 in (7,8,9) then Rank_rng = '7_9'; else Rank_rng = 'NO_Rank'; end; else If city_code = 101 then do; If Rank_101 in (1,2,3) then Rank_rng = '1_3'; else if Rank_101 in (4,5,6,7,8) then Rank_rng = '4_8; else if Rank_101 in (13,14,15) then Rank_rng = 13_15; else Rank_rng = 'NO_Rank'; end; else If city_code = 102 then do; If Rank_102 in (20,21,22) then Rank_rng = 20_22; else if Rank_102 in (23,24,25,26) then Rank_rng = 23_26; else if Rank_102 in (27,28,29,30) then Rank_rng = 27_30; else Rank_rng = 'NO_Rank'; end; Run; Can someone help me to put the above if/then statements into Proc sql nested case when statements? Thanks in advance for your help.
... View more