Hello everyone,
I am looking to read ICD10 diagnosis codes into one variable and the code description in another variable.
What is the input statement switch that will allow me to do this?
Example: Newborn only diagnosis codes and descriptions:
DATA sparcs.input_newborn_icd10_2017;
INPUT DX $ ;
DATALINES;
A33 Tetanus neonatorum
E8411 Meconium ileus in cystic fibrosis
H04531 Neonatal obstruction of right nasolacrimal duct
H04532 Neonatal obstruction of left nasolacrimal duct
H04533 Neonatal obstruction of bilateral nasolacrimal duct
H04539 Neonatal obstruction of unspecified nasolacrimal duct
N470 Adherent prepuce, newborn
Z00110 Health examination for newborn under 8 days old
Z00111 Health examination for newborn 8 to 28 days old
Z3800 Single liveborn infant, delivered vaginally
Z3801 Single liveborn infant, delivered by cesarean
Z381 Single liveborn infant, born outside hospital
Z382 Single liveborn infant, unspecified as to place of birth
Z3830 Twin liveborn infant, delivered vaginally
Z3831 Twin liveborn infant, delivered by cesarean
Z384 Twin liveborn infant, born outside hospital
Z385 Twin liveborn infant, unspecified as to place of birth
Z3861 Triplet liveborn infant, delivered vaginally
Z3862 Triplet liveborn infant, delivered by cesarean
Z3863 Quadruplet liveborn infant, delivered vaginally
Z3864 Quadruplet liveborn infant, delivered by cesarean
Z3865 Quintuplet liveborn infant, delivered vaginally
Z3866 Quintuplet liveborn infant, delivered by cesarean
Z3868 Other multiple liveborn infant, delivered vaginally
Z3869 Other multiple liveborn infant, delivered by cesarean
Z387 Other multiple liveborn infant, born outside hospital
Z388 Other multiple liveborn infant, unsp as to place of birth
;
RUN;
This code reads in the ICD10 DX code and stops at the first blank character. Great.
How do I read the rest of the data as one character variable, such as NBdescription?
I will use this technique multiple times for the numerous code/description pairs I will come across.
Thanks in advance.
Stephen Dybas
Here's something you could try:
data want;
length nbDescription $ 200;
input dx $ nbDescription $ &;
datalines;
....
;
Use a sufficiently long informat to force formatted input, and the truncover option:
data test;
infile cards truncover;
input DX $100.;
cards;
A33 Tetanus neonatorum
E8411 Meconium ileus in cystic fibrosis
H04531 Neonatal obstruction of right nasolacrimal duct
H04532 Neonatal obstruction of left nasolacrimal duct
H04533 Neonatal obstruction of bilateral nasolacrimal duct
H04539 Neonatal obstruction of unspecified nasolacrimal duct
N470 Adherent prepuce, newborn
Z00110 Health examination for newborn under 8 days old
Z00111 Health examination for newborn 8 to 28 days old
Z3800 Single liveborn infant, delivered vaginally
Z3801 Single liveborn infant, delivered by cesarean
Z381 Single liveborn infant, born outside hospital
Z382 Single liveborn infant, unspecified as to place of birth
Z3830 Twin liveborn infant, delivered vaginally
Z3831 Twin liveborn infant, delivered by cesarean
Z384 Twin liveborn infant, born outside hospital
Z385 Twin liveborn infant, unspecified as to place of birth
Z3861 Triplet liveborn infant, delivered vaginally
Z3862 Triplet liveborn infant, delivered by cesarean
Z3863 Quadruplet liveborn infant, delivered vaginally
Z3864 Quadruplet liveborn infant, delivered by cesarean
Z3865 Quintuplet liveborn infant, delivered vaginally
Z3866 Quintuplet liveborn infant, delivered by cesarean
Z3868 Other multiple liveborn infant, delivered vaginally
Z3869 Other multiple liveborn infant, delivered by cesarean
Z387 Other multiple liveborn infant, born outside hospital
Z388 Other multiple liveborn infant, unsp as to place of birth
;
run;
Here's something you could try:
data want;
length nbDescription $ 200;
input dx $ nbDescription $ &;
datalines;
....
;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.