How can I split these dates into mm , yy and dd for full dates and yy, and mm for partial dates? These dates are character values.
feb2010 05mar2010 05jan2010 25jul2010
aug2010
Use SUBSTR() to extract parts of strings, and LENGTH() to determine if a day is present or not.
I tried with ' substr ' funcation , it worked but if we have to change mm, yy and dd into numeric form and create a date format for partial date ,how can we do that?
Please show which values you want to get for each of your example strings.
data want;
date = '05jan2010';
date_num = input(date,date9.);
format date_num ddmmyy10.;
run;
@u52766097 wrote:
jan2010 05mar2010 05jan2010 25jul2010
feb2010 05mar2010 05jan2010 25jul2010
And which separate numeric day, month and year values do you want to get for each of these strings?
And which day of the month needs to be set from an incomplete string?
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.