converting format (from date to numeric) using SAS -
i working dataset in sas, containing many variables.
one of these variables date variable , has date/time format. looks this:
12feb97:00:00:00 27mar97:00:00:00 14apr97:00:00:00
now thing convert variable numeric format. , following result (based on shown 3 examples):
199702 199703 199704
do have ideas how it? read through many docs, pdfs etc. still not find proper solution yet.
thank much!
first, need extract date datetime variable. can use datepart
function:
date = datepart(var);
then, want put variable (which still coded date number) number can read year , month. putn
:
date_as_num = putn(date,'yymmn6.');
Comments
Post a Comment