So, I have a column for just years but its showing as a numeric value in sas.
How do I convert it to years in sas studio.
What I tried
- I tried the ttransforming the data but I keep running to an error because I dont know the exact Format
I want it to be a date
Alright, thanks.
can you give me like a sample code idea for it. I will work out the rest...
data have;
input Time;
datalines;
2011
2010
2004
;
run;/* Create a new variable with January 1st of each year */
data want;
set have;
/* using MDY function with January 1st */
new_date = mdy(1, 1, year);
format new_date year4.; /* Format the date to display only the year */
run;
Tried this, it didnt work...
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Select SAS Training centers are offering in-person courses. View upcoming courses for: