Hi,
below is my data:
I want to create above dates in ISO date format like 2019-02-28 & 2019-03-18.
Could you please help me with this.
Thanks,
Adithya
If the values really look like that then the DATE informat should work, just make sure to use a long enough width.
aestdat_date = input(aestdat_raw,date11.);
format aestdat_date yymmdd10.;
We have a Table with a date in format MMM-19. Example MAY-19. Is there a way to generate a new sortable date column from this format? Preferably 2019-05-31 in this example. Any help would be much appreciated.
The last date in the month would be preferred.
You should create your own thread instead, but here is an example that works if the date is an actual string and not just a formatted numeric value. If it is numeric to begin with, just use the intnx function.
data want;
date_s = "MAY-19";
date_n = input(compress(date_s,"-"),monyy.);
end_date_n = intnx ('month',date_n,0,'E');
format date_n end_date_n yymmdd10.;
run;
Hi,
Is that variable a string or a SAS numeric date? Do you want the variable to be a SAS date or a string?
If it is a numeric, then you just have to change the format of that column to yymmdd10.
If it is a string, then you have to use an input function to translate it to a SAS date.
E.g.
data have;
aestdat_raw = "28 feb 2019";
run;
data want;
set have;
aestdat_date = input (compress(aestdat_raw), date9.); *Use compress to remove the spaces, or you will get the year 2020!;
format aestdat_date yymmdd10.;
run;
Hi all,
got it below is my code for my question:
want=input(AESTDAT_RAW,anydtdte20.);
format want yymmdd10.;
Thanks!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.