将字符串转换为日期格式

Convert character string to date format

我正在尝试转换 $40 的字符串。迄今为止的格式。 下面是数据集 test2 中的月份列及其值:

Month
Apr 15
May 15
Jun 15

我试过这段代码,但没有得到我期望的结果。

data test;
  set test2;
  Month =inPUT(month,monyy5.);
/*  Mon=input(month,8.);*/
/*  format month $MonYY5.;*/
run;

谢谢

请将输入应用于新列,因为您不能直接更改列的类型(char 到 num)。

data test2; length mm ; mm='APR15'; output; mm='MAY14'; output; run;

data test (rename=(_mm=mm));
set test2;
_mm=input(mm,monyy5.);
format _mm monyy.;
drop mm;
run;
 data test(Rename=(MM=Month));
   set test2;
   MM =inPUT(Month,monyy5.);
 format MM $MonYY5.;
 Drop MM;
 run;