BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
agoldma
Pyrite | Level 9

The current documentation on the picture format seems to imply that we should use both the %S and the %s directives in order to display the seconds and the fractional seconds. From what I see (in SAS version 9.04.01 M4) we should use only the %s directive by itself. It displays both the full and the fractional seconds.

 

Example:

proc format;
   picture fm_db2_date_time  (default=26)
   other = '%Y-%0m-%0d %0H:%0M:%000000s'  (datatype=datetime)
   ;
run;
proc sql;
   select dhms('01may2012'd,13,5,2.876543)  format=datetime26.6           'built-in format'
         ,dhms('01may2012'd,13,5,2.876543)  format=fm_db2_date_time26.6   'picture format'
   from   sashelp.class(obs=1)
;quit;

 

I wanted to submit a request for a usage note, but I couldn't find how to do that.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

@agoldma for something like this you can either contact tech support or post on SASware Ballot section where it can be voted on. 

https://communities.sas.com/t5/SASware-Ballot-Ideas/idb-p/sas_ideas

 

View solution in original post

3 REPLIES 3
ballardw
Super User

Some of the behavior differences are more obvious when you do not provide the w.d at use.

Such as:

proc format library=work;
   picture fm_db2_me  (default=26)
   other = '%Y-%0m-%0d %0H:%0M:%0S.%s'  (datatype=datetime)
   ;
   picture fm_db2_date_time  (default=26)
   other = '%Y-%0m-%0d %0H:%0M:%000000s'  (datatype=datetime)
   ;
run;

data _null_;
   x='01may2012:13:05:02.1234567'dt;
   put "datetime format " @25 x= datetime.    ;
   put "fm_db2_date_time format " @25 x= fm_db2_date_time. ;
   put "fm_db2_me format " @25 x=fm_db2_me.;
run;

where the format with %0S and %s shows a different number of displayed characters even though it has the same default length.

 

agoldma
Pyrite | Level 9
Thank you for showing a common difficulty -- forgetting to use w.d with decimals
That's exactly what I was doing wrong before I remembered to use the decimals

Reeza
Super User

@agoldma for something like this you can either contact tech support or post on SASware Ballot section where it can be voted on. 

https://communities.sas.com/t5/SASware-Ballot-Ideas/idb-p/sas_ideas

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2334 views
  • 4 likes
  • 3 in conversation