I have data like
20170822,
NK/NK/2017 how i can convert data into date9 format...?
To what date would you expect the string NK/NK/2017 to get resolved? 01Jan2017? ...or something else?
@KalaBhairava, pay attention:
the given date 20170822 when displayed in date9. format will look like: 22AUG2017.
when given date is NK/NK/2017 - what do you want to display as DAY and what as MONTH ?
NK is not numeric valid DAY and not a valid MONTH.
Your answer to @Patrick is not clear.
In one variable i want dates like
22aug2017
Nk/NK/2017
23aug2018
No it should be NK/NK/2017 only
@KalaBhairava wrote:
No it should be NK/NK/2017 only
Then you can only store this data-crap as text, not as SAS dates.
Not clear what you have and what you need.
"NK/NK/2017" is not a date in any calendar i have seen so far.
NK means unknown date values i want present all values in one variable ,for more information please find below variable start data
Startdate
07-AUG-2017
11-AUG-2017
08-AUG-2017
NK NK 2018
NK NK NK
07-AUG-2017
@KalaBhairava wrote:
NK means unknown date values i want present all values in one variable ,for more information please find below variable start data
Startdate
07-AUG-2017
11-AUG-2017
08-AUG-2017
NK NK 2018
NK NK NK
07-AUG-2017
AND WHAT SHOULD BE USED IN PLACE OF 'NK' FOR MONTH AND DAY???
A SAS date ALWAYS(!!!) needs a day and month, period. It describes exactly one existing day of a year.
And NK NK NK is of course totally unusable, but there you could at least create a valid missing value.
I need to present it as NK/NK/2017 in date variable if i converted into date9. the NK will become blank i want it as NK/NK/2017
@KalaBhairava wrote:
I have data like
20170822,
NK/NK/2017 how i can convert data into date9 format...?
You can't, as NK/NK/2017 is not a date. I don't know of a day NK in any calender system I can think of, and NK isn't a month either.
I understand that your input date si a char type,
with normal date in a format of yyyymmdd, then you can try do:
length new_date $10;
test_date = input(date, ?? yymmdd8.).
if test_date = . then new_date = date;
else new_date = put(date,date9.);
drop test_date;
Thank you very much Sir..
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.