Home / Expert Answers / Statistics and Probability / in-sas-run-the-following-data-step-to-create-the-temporary-sas-data-set-suppose-that-you-want-to-pa604

# (Solved): In SAS Run the following data step to create the temporary SAS data set. Suppose that you want to ...

In SAS Run the following data step to create the temporary SAS data set. Suppose that you want to create two new data sets separating the records with an invalid form from those with a valid form for the MRN which is four digits followed by two upper-case letters, a dash and then a single digit. Use a regular expression function and print the two new data sets. data LabVis ; informat MRN \$10. LabDate date9. Sex \$1. Anemia VitalStat \$1.; input MRN LabDate HGB Sex Anemia VitalStat; format LabDate date9.; label MRN='Medical Record Number' HGB='hemoglobin (g/dL)'; datalines; 1234MT-3 12MAR2019 12.3 F 1 . 6655Bf-4 15JAN2019 16.9 M 0 A 996TU-4 09SEP2019 18.2 F 0 D 0003BF-9 05MAY2019 . F 1 D 9876TU-6 09AUG2019 13.9 M 1 A 339956TU-8 09SEP2019 18.2 F 0 A 9176tu-6 09AUG2019 13.9 . 0 A 6655BF-4 15JAN2019 16.9 F . D 1255BF4 15FEB2019 15.4 F 0 D 66655BF-4 15JAN2019 14.0 M 1 A 0655MT-5 01MAR2019 17.3 M 0 D 0654T6-7 01MAR2019 14.4 . 1 A TU8888-0 07JUN2019 13.3 F 0 A 5431TU-8 19SEP2019 18.2 F 0 A 4444FB-2 29AUG2019 11.9 M 1 A 6655BF-4 15JAN2019 16.4 F 0 A 1255-BF4 15DEC2019 13.4 F 0 D 66655BF4 15JUL2019 14.0 M 1 A 1655MT-5 01OCT2019 17.3 M 0 D 0000MT-7 01OCT2019 14.4 . 1 A 8888TU-0 17JUN2019 13.3 F 0 A 777M8T-9 27MAY2019 14.3 F 1 A 5431TU-8 19SEP2019 18.2 F 0 A ;

We have an Answer from Expert