This is a more complete approach: %let start=1.6.0.0; %let end=1.7.255.255; data ip_ad (keep=ip_address); start_ad = 0; do i = 1 to 4; i1 = input(scan("&start",i,'.'),3.); start_ad = start_ad + i1 * 256**(4-i); end; end_ad = 0; do i = 1 to 4; i1 = input(scan("&end",i,'.'),3.); end_ad = end_ad + i1 * 256**(4-i); end; length ip_address $ 15; do address = start_ad to end_ad; ip_address = ' '; char_ad = put(address,hex8.); do i = 0 to 3; ip_address = compress(ip_address !! put(input(substr(char_ad,i*2+1,2),hex2.),best3.)); if i ne 3 then ip_address = trim(ip_address) !! '.'; end; output; end; run; RW9's example would have problems with start=1.7.0.0 end=2.6.255.255
... View more