Here's a stumper. The following code produces an output file with 3
unwanted leading blanks before the timestamp. Many thanks to anyone who
can explain where the blanks are coming from, or simply tell me how to
get rid of them.
Thanks!
Paul
proc format;
picture tms
other='%000Y-%0m-%0d-%0H.%0M.%0S'(datatype=datetime);
run;
data _null_;
tms=0;
file 'YOUR_OUTPUT_FILE.txt';
put maint_tms tms.
;
run;
|
|
0
|
|
|
|
Reply
|
paulvonhippel (114)
|
6/19/2006 7:17:40 PM |
|
On Mon, 19 Jun 2006 12:17:40 -0700, Paul <paulvonhippel@YAHOO.COM> wrote:
>Here's a stumper. The following code produces an output file with 3
>unwanted leading blanks before the timestamp. Many thanks to anyone who
>can explain where the blanks are coming from, or simply tell me how to
>get rid of them.
>
>Thanks!
>Paul
>
>proc format;
> picture tms
> other='%000Y-%0m-%0d-%0H.%0M.%0S'(datatype=datetime);
>run;
>data _null_;
> tms=0;
> file 'YOUR_OUTPUT_FILE.txt';
>put maint_tms tms.
>;
>run;
Two things. I don't think %000Y will give you the desired results. In 8.2 I
get 0Y in the output. Chaneg this to %Y. The second piece is to allign the
PUT statement with a -L. In summary
>proc format;
> picture tms
> other='%Y-%0m-%0d-%0H.%0M.%0S'(datatype=datetime);
>run;
>data _null_;
> tms=0;
> file 'YOUR_OUTPUT_FILE.txt';
put tms tms. -L ;
>;
>run;
|
|
0
|
|
|
|
Reply
|
swovcc (585)
|
6/19/2006 7:39:20 PM
|
|
Try:
proc format;
picture tms
other='%Y-%0m-%0d-%0H.%0M.%0S'(datatype=datetime); /*** Removed
leading zeros b4 year **/
run;
data _null_;
tms=datetime() ;
put tms tms19. ; /*** Added width to format **/
run;
Which produces:
45 data _null_;
46 tms=datetime() ;
47 *file 'YOUR_OUTPUT_FILE.txt';
48 put tms tms19. ; /*** Added width to format **/
49 run;
2006-06-20-07.37.04
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
Paul wrote:
>Here's a stumper. The following code produces an output file with 3
>unwanted leading blanks before the timestamp. Many thanks to anyone who
>can explain where the blanks are coming from, or simply tell me how to
>get rid of them.
>
>Thanks!
>Paul
>
>proc format;
> picture tms
> other='%000Y-%0m-%0d-%0H.%0M.%0S'(datatype=datetime);
>run;
>data _null_;
> tms=0;
> file 'YOUR_OUTPUT_FILE.txt';
>put maint_tms tms.
>;
>run;
>
>
>
>
--
============================================================
Robin & Charmaine Templer
Wellington, New Zealand
Email: robin.templer@xtra.co.nZ
FAX : 64-4-476-4299
Phone: 64-4-476-4299
|
|
0
|
|
|
|
Reply
|
robin.templer (124)
|
6/19/2006 7:39:41 PM
|
|