Here is a solution which will write the original 'code' and its expansion to the log. It can be adapted to write to a file. Fortuitously it deals with the miscode spotted by Data _Null_. Next step named in honour. Data _null_ ; input codes $char60. ; length code base range result $8 ; codes = compress(codes, "'") ; Do k = 1 to 99 ; code = scan (codes, k, ', ') ; if missing(code) then return ; range = scan (code, 2, '.') ; base = scan (code, 1, '.') ; m = input (scan (base, 1, 'C-'), 2.) ; n = input (scan (base, 2, 'C-'), 2.) ; p = input (scan (range, 1, '-'), 1.) ; q = input (scan (range, 2, '-'), 1.) ; if missing (range) then do ; p = 0 ; q = 9 ; end ; put code '> ' ; do j = m to max (m, n) ; base = cat ('C', put (j, z2.)) ; do i = p to max (p, q) ; result = catx ('.', base, i) ; put result @ ; end ; end ; put ; end ; drop codes i j k m n p q base range ; Datalines ; 'C00.3-5, C02-04, C05.0, C05.8-9, C06' 'C01, C10.0, C10.2-3, C10.8-9, C11-12' 'C01, C05.1-2, C09, C10.0, C10.2-3, C10.8-9, C11-14' 'C44.0-4, C47.0, C49.0, C00-14, C30-32, C73' 'C44.5, C44.8-9, C47.6-9, C49.6-9' 'C00-C26, C32-C69, C73, C75.4-9, C76-C80' 'C00-50, C60-61, C63-69, C73-74, C76-80' 'C00, C03-08, C15-17, C19-41, C44-76' 'C00, C03-08, C15-17, C19-41, C44-76' run ; Richard
... View more