01-29-2015 04:29 AM
i have the dataset with variables id name joining date and salary
the birthdate is in the format date9.
now i have to read birthday only year i am trying with substr function but not getting the result.
can some one help me.
i tried as
Is it correct?
01-29-2015 06:19 AM
Just use the year() function. If you need it as character, wrap it into put(year(join_date),4.);
01-29-2015 07:05 AM
Is your join date variable a character or number/sas date. If its a number then Kurts solution is correct. If its a char yours is close but need to remove quotes and d from around join_date variable. Its not a good method because what if the date is shorter in some circumstances though.
01-29-2015 08:25 AM
I agree with Reeza on the character. If its a date then you would normally have some kind of delimiter between day/month/year. Easier to check that:
Should set year="2000" as its the third part.
01-29-2015 09:44 AM
Hi there, I'm moving this from the "about Communities on SAS" space to the SAS Procedures space just so that these answers are visible to others in that area. Thanks!