I would be most appreciative for any help someone could give me.
I have date values in records where the data scanning process (for some reason) includes an asterisk within the date value. The date is converted to a string when it's scanned so the asterisk is allowed. I can convert the string date to a true date but I am faced with multiple errors because of the asterisks. I've tried various iterations of tranwrd and compress but I can't seem to get it right. I think, (perhaps mistakenly), that the asterisk is being treated as a wildcard in those functions?
Alternatively I could simple exclude anything that is not a valid date since the imperfect scanning process gives me results such as:
00/23/2009
04/2 /90 9
Thanks for any help you might be able to provide.
Sample data:
*6/08/2009
5/*1/2009
You're using the right tools ... maybe just not quite in the right way. Try:
chardate = compress(chardate, '* ');
numdate = input(chardate, mmddyy10.);
You're using the right tools ... maybe just not quite in the right way. Try:
chardate = compress(chardate, '* ');
numdate = input(chardate, mmddyy10.);
Thank you for the response but it doesn't work. It could be I have something else going on here. Here is what I used:
temp_date = compress(date,'*');
surveydate = input(temp_date,mmddyy10.);
And here is what I got back:
NOTE: Invalid argument to function INPUT at line 24 column 15.
month=June2009 idnumber=111111111 date=06/04/* 77
Post the actual log. For example, what's the value of temp_date.
Look very closely at @Astounding code sample. It includes both an asterisk AND a space in the arguments to the compress function.
If you modify your compress function it will work.
If you look at the error in your log closely you'll see the extra space (red underscore here).
Thanks for calling my attention to that. I didn't see it.
I appreciate all your help.
You got month=June2009 and date=06/04/* 77, are those two fields supposed to be related?
Thank you. I appreciate all the help for everyone.
Happy Friday.
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.