HI...i have posted a message earlier asking how to use the YEAR() funciton. However, when I applied it to the data that I have, it only returns one record, one empty record.
I have an existing data of 600 records with column names VarID, VarName, VarDate, VarInfo, VarGender...etc. The VarDate is in mmddyy10. format.
I want to read the VarDate column and save this as a new data. I also want to apply the YEAR() to the VarDate column. But I only get 1 empty rec.
Here is the code that I wrote:
libname mydata 'C:\work\analysis';
libname myfmts 'C:\work\analysis';
data mydata.newFiles;
infile 'C:\work\analysis\rdata.dat';
input DateEvent mmddyy10.;
y=year(DateEvent);
run;
proc print data=mydata.newFiles;
options fmtsearch=(myfmts work);
var y;
run;
What did i do wrong? I just want to read that date column and extract the year from the value so I can get a count of the recs for each year.
Thanks a lot for the help!
I have an existing data of 600 records with column names VarID, VarName, VarDate, VarInfo, VarGender...etc. The VarDate is in mmddyy10. format.
I want to read the VarDate column and save this as a new data. I also want to apply the YEAR() to the VarDate column. But I only get 1 empty rec.
Here is the code that I wrote:
libname mydata 'C:\work\analysis';
libname myfmts 'C:\work\analysis';
data mydata.newFiles;
infile 'C:\work\analysis\rdata.dat';
input DateEvent mmddyy10.;
y=year(DateEvent);
run;
proc print data=mydata.newFiles;
options fmtsearch=(myfmts work);
var y;
run;
What did i do wrong? I just want to read that date column and extract the year from the value so I can get a count of the recs for each year.
Thanks a lot for the help!