I am trying to create a file from SAS with date and timestamp on as below, NAME_201907241615A.TXT I could able to get the date in YYYYMMDD format using date() function with YYMMDDN8 format. But i am finding difficult to get the time in 24 hr format. Or else if time is 9 AM , space is coming before 9 instead of 09. So i tried this logic and it is working good as expected, %let Time = %sysfunc(time(),time.) ; %let Time_HH = %scan(&Time,1,:) ; %let Time_MM = %scan(&Time,2,:) ; HH=PUT(&TIME_HH,2.); if length(hh)<3 and '0'>= hh < '10' then hh=repeat('0',2-length(hh))||strip(hh); MM =PUT(&TIME_MM,2.); if length(mm)<3 and '0'>= mm < '10' then mm=repeat('0',2-length(mm))||strip(mm); var9="EDS"||"_"||"&VEN"||"_"||"&LOB"||"_"||"&TYP"||TRIM("_")||strip(%sysfunc(date(),YYMMDDN8.))||TRIM(HH)||TRIM(MM)||TRIM("A")||&VER; The red highlighted portion i tried to get hour and minute as 2 digit (like 09), if the time is single digit. I think there could be a straightforward approach , which i am missing. Is there is any other options to do this simply?Can we do this using picture clause in format? Thanks, Meenakshi
... View more