Hi, I met one log issue from below code when using the macro call, would you please help? Thanks!!! proc format; value $__mth '01' = 'JAN' '02' = 'FEB' '03' = 'MAR' '04' = 'APR' '05' = 'MAY' '06' = 'JUN' '07' = 'JUL' '08' = 'AUG' '09' = 'SEP' '10' = 'OCT' '11' = 'NOV' '12' = 'DEC' ' ' = 'UNK' ; value $__yr ' ' = 'UNK' ; run; *dtc may be like 2003-12-15T13:15:17; %macro date(dtc=); * display as DDMMMYYYY; length yy mm dd $5 dtc date $19; dtc =%scan(&dtc.,1,T); /* dtc =&dtc.;*/ if length(dtc)=10 and index(dtc,'--')=0 then date=strip(put(input(dtc,yymmdd10.),date9.)); else if length(dtc)=4 then date=strip(substr(dtc,1,4)); else if length(dtc)=9 then do; * 2003---15; yy=substr(dtc,1,4); mm=' '; dd=substr(dtc,8,2); date=strip(dd)||strip(put(mm,$__mth.))||strip(yy); end; else if length(dtc)=7 then do; * --12-15; yy=' '; mm=substr(dtc,3,2); dd=substr(dtc,6,2); date=strip(dd)||strip(put(mm,$__mth.))||strip(put(yy,$__yr.)); end; drop yy mm dd ; %mend date; data raw; HOSPSDTC='';output; run; data final; length col4 $200; set raw; %date(dtc=HOSPSDTC); col4=date; run; I don't understand why there's one log issue that "NOTE: Variable HOSPSD is uninitialized." when using the macro call %date. I think it's related to the %scan function. Is there anything wrong? the variable is HOSPSDTC, but the log issue is regarding to HOSPSD... It's weird...
... View more