How to display date as DD MMM YYYY imported from .csv -


i have service picks .csv , processes .sas7bdat.

i modify existing .sas template filling in variable names, length, , specifying output location.

i have scenario in .csv has date formatted 'dd mmm yyyy'. need preserve format output file. predefined formats allow 'ddmmmyyy' , 'dd-mmm-yyyy'. have tried these format types in template.

below template standard character type:

libname tempsrc "c:\temp"; proc import datafile="\\***\filelocation\file.csv"         out=mydata dbms=dlm replace;         delimiter= ",";         getnames=yes;         options extendobscounter=yes; run; data tempsrc.filename;     attrib      datevar length=$11  format=$11.     informat=$11.       label='date'             ;             set work.mydata; run; 

how can modify code output date follows '01 jan 2000'

edit:

how can output value .sas7bdat character value?

there isn't default format display dd mmm yyyy it's necessary roll own. believe following gives trying achieve:

proc format; picture ddmmmyy   other= '%0d %b %y' (datatype=date); run;  data have;   datevar='01 jan 2000'; run;  data want;   set have;   actualdatevar=input(datevar,anydtdte11.);   format actualdatevar ddmmmyy11.; run; 

gives:

enter image description here

note cannot convert character variable numeric, may wish create new variable , drop old 1 (can rename new variable end same named variable).

edit1: apply specific answer (now situation clearer)

the following should achieve needed:

libname tempsrc "c:\temp";  proc format; picture ddmmmyy   other= '%0d %b %y' (datatype=date); run;  proc import datafile="\\***\filelocation\file.csv"         out=mydata dbms=dlm replace;         delimiter= ",";         getnames=yes;         options extendobscounter=yes; run; /* if need apply format, may better using proc datasets */ data tempsrc.filename;     set work.mydata;     format datevar ddmmmyy11. ; run; 

edit2: converting character displayed correctly in universal viewer (without custom format)

libname tempsrc "c:\temp";  proc format; picture ddmmmyy   other= '%0d %b %y' (datatype=date); run;  proc import datafile="\\***\filelocation\file.csv"         out=mydata dbms=dlm replace;         delimiter= ",";         getnames=yes;         options extendobscounter=yes; run; /* convert numeric character via rename */ data tempsrc.filename;     set work.mydata (rename=(datevar=datevar2));     datevar=put(datevar2,ddmmmyy11.);   drop datevar2; run; 

Comments