@_CJY_ wrote:
Balladrw,
Thank you so much for your suggestions. All of it was extremely useful. Did not realize FORMAT function would not work inside a do block.
data &file._;
set &file (rename=(deptchecktime=deptwarp admitTime=admitwarp));
if vtype(admitwarp)="C" then admitTime=input(admitwarp,time20.3);
format admitTime time20.3;
if vtype(deptwarp)= "C" then deptchecktime=input(deptwarp,time20.3);
format deptcheckTime time20.3;
drop deptwarp admitwarp;
run;
Format works just fine. The location in the code doesn't matter unless you have two format statements for the same variable in which case the last one encountered is going to apply. See below for brief example.
data work.example;
format x best4.;
do;
x = 1.234;
format x percent8.3;
end;
run;
data work.example2;
format x percent8.3;
do;
x = 1.234;
end;
format x best4.;
run;
There are several non-executable statements such as Format, Informat, Attrib, and Label.
... View more