As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Tips:Validate the format of ICD-9 codes

From sasCommunity
Jump to: navigation, search

You can use regular expressions to test/validate the format of ICD-9 diagnosis codes. For example:

  data probably_good_codes(drop = match_loc) obviously_bad_codes ; 
      retain rgx_handle ; 
      set my_dataset ; 
      if _n_ = 1 then do ; 
          rgx_handle = prxparse("/^(V\d{2}(\.\d)?|\d{3}(\.\d{1,2})?|E\d{3}(\.\d)?)/") ; 
      end; 
      match_loc = prxmatch(rgx_handle, dx) ; 
      if match_loc = 1 then output probably_good_codes ; 
      else output obviously_bad_codes ; 
  run;

View the read more link for details about the PRX logic.

Submitted by Roy Pardee. Contact me at my Discussion Page.

....read more