Hi. In the following data, I want to do two things:
1. split the Age variable into two variables - age and sex using the "/" as the condition in the Age variable
2. In the remaining age variable for all ages less than a year, replace it with "1". For example, in observation 2 and 3 below, the age variable would be "1" for both
Any help would be much appreciated.
1. split the Age variable into two variables - age and sex using the "/" as the condition in the Age variable
2. In the remaining age variable for all ages less than a year, replace it with "1". For example, in observation 2 and 3 below, the age variable would be "1" for both
Any help would be much appreciated.
Code:
input str15 MRNo str8 Age "P1610634" "68/F" "P1602163" "1 Mo. /M" "P1602154" "7 Mo. /M" "PN1585614" "1/F" "PN1401224" "2/M" "P1609543" "63/M" "P1610326" "46/F" "P1257195" "4/F" "P1411821" "2/M" "P1539542" "30/M" "P1610610" "69/F" "N500364" "50/M" "KVC-P145026" "57/F" "P352115" "33/F" "P1541985" "26/F" "P1519669" "21/F" "P1598091" "73/M" "N492028" "9/M"
Comment