Hi Everyone,
I'm have a text file with date of birth entered in the format of mm/yyyy in numbers. So for example 5/1985.
When I try to tell sas to read the data with informat - DOB monyy6. it says invalid data for DOB. I'm guessing that it's because it's not a 3 letter representation of a month.
What would be the other informat because I tried mmyy6. and that doesn't exist.
Here's my code:
data temp; infile 'C:\Users\wjeon\Desktop\Masters\Data to William\PEI data/PEItxt.txt' delimiter='09'x dsd missover firstobs=2; length Patient_ID $20; informat Patient_ID $20. Gender 1. DOB mmyy10. Postal_Code $3. Region 1. Date_of_Service mmddyy10. Facility_type_id 2. ICD_9 $4. Specialty 3. Paid_amt best32. Approved_amt best32. Fee_Code $4.; input Patient_ID Gender DOB Postal_Code Region Date_of_Service Facility_type_id ICD_9 Specialty Paid_amt Approved_amt Fee_Code; run;
I also tried to make it read it as characters so that i can try to convert it later on but it still says invalid
Thank you in advance.
data test;
input DOB $ ;
dt = input('01/'!!DOB,ddmmyy10.);
format dt mmyys. ;
datalines;
3/2011
;
run;
Use the ANYDTDTE. informat.
data want;
informat dob anydtdte.;
format dob date9.;
input dob;
cards;
1/2016
5/2011
12/2010
;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.