Hi,
I know how to use the YEAR() with raw data using with input statement. like below:
DATA dates;
INPUT name $ 1-4 @6 bday mmddyy11.;
m=MONTH(bday);
d=DAY(bday) ;
y=YEAR(bday);
wk_d=WEEKDAY(bday);
q=QTR(bday);
CARDS;
John 1 1 1960
Mary 07/11/1955
Joan 07-11-1955
Kate 11.12.1962
Mark 06081959
;
RUN;
PROC PRINT DATA=dates;
VAR bday m d y;
FORMAT bday date9. ;
RUN;
My question is, how to use YEAR() with an existing data? I tried so many websites on this and i still can not find any solution. I have a .dat file with dates in it, I just need to generate a frequency table based on year. The dates are in mmddyy format. I need to extract the year from the mmddyy format like YEAR(), but I can not make it to work. So I copied all the data using proc print and then used the steps from above. I guess my question is how to create and use variables for permanent data files. They only have examples on temporary data like the one shown above. Thanks!
I know how to use the YEAR() with raw data using with input statement. like below:
DATA dates;
INPUT name $ 1-4 @6 bday mmddyy11.;
m=MONTH(bday);
d=DAY(bday) ;
y=YEAR(bday);
wk_d=WEEKDAY(bday);
q=QTR(bday);
CARDS;
John 1 1 1960
Mary 07/11/1955
Joan 07-11-1955
Kate 11.12.1962
Mark 06081959
;
RUN;
PROC PRINT DATA=dates;
VAR bday m d y;
FORMAT bday date9. ;
RUN;
My question is, how to use YEAR() with an existing data? I tried so many websites on this and i still can not find any solution. I have a .dat file with dates in it, I just need to generate a frequency table based on year. The dates are in mmddyy format. I need to extract the year from the mmddyy format like YEAR(), but I can not make it to work. So I copied all the data using proc print and then used the steps from above. I guess my question is how to create and use variables for permanent data files. They only have examples on temporary data like the one shown above. Thanks!