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

I have what I think may be a rather elementary question, but I can't find an answer.

 

How can I format the time displayed at the top of the page in my SAS log?  On one of my servers it's in 24 hour format ("military time") and on another in 12 hour format (AM/PM).  I know about the DATE and DTRESET options, but I'm not aware of an option that controls the format of the time printed at the top of the page.  I'm thinking that there must be such a thing because my two servers differ.  Note:  One of the servers is running Windows Server 2016 and the other is RHEL (Linux).

 

Example of what I'd like to change from:

Thursday, July 30, 2020 07:16:30 PM

Example of what I'd like change to:

18:43 Thursday, July 30, 2020

I suspect these may be controlled by the LOCALE settings, but I've not been able to confirm my suspicions or find out how to change to what I prefer.

 

Thank you in advance,

 

Jim

1 ACCEPTED SOLUTION

Accepted Solutions
jimbarbour
Meteorite | Level 14

@SASKiwi, thank you for checking.

 

Actually, being to stubborn to take "no" for an answer, I kept searching the documentation, and:  It's a combination of the LOCALE and DFLANG options that seems to work.

 

I wrote a little macro to demonstrate this (below).  What it does is try various settings of the LOCALE option and then sets the DFLANG to LOCALE.  

&Null	%MACRO	Try_Locale(Locale);
	OPTION	LOCALE	=	&Locale;
	OPTION	DFLANG	=	LOCALE;

	%PUT	&Nte2;

	DATA	_NULL_;
	RUN;

	%PUT	&Nte2;
	%PUT	&Nte2;
%MEND	Try_Locale;

 

When I execute the macro, supplying various settings of LOCALE, we can see the date and time formats change at the top of the page in the SAS log.  As it happens, when LOCALE=EN_GB, that's precisely what I wanted.  One has to be a little careful here.  The DFLANG could change the DATESTYLE.  Date style is MDY in the USA, but it is DMY in much of the rest of the world.

29         %Try_Locale(en_AU);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

2 The SAS System                 Friday, 31 July 2020 12:31:16 AM

     
     
30         
31         %Try_Locale(EN_BE);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

3 The SAS System             Friday 31 July 2020 00 h 31 min 16 s

     
     
32         
33         %Try_Locale(EN_BW);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

4 The SAS System                  Friday 31 July 2020 12:31:16 AM

     
     
34         
35         %Try_Locale(EN_CA);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

5 The SAS System                Friday, 31 July, 2020 12:31:16 AM

     
     
36         
37         %Try_Locale(EN_CB);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

6 The SAS System                Friday, July 31, 2020 12:31:16 AM

     
     
38         
39         %Try_Locale(EN_GB);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

7 The SAS System                    Friday, 31 July 2020 00:31:16

     
     
40         
41         %Try_Locale(EN_HK);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

8 The SAS System                Friday, 31 July, 2020 12:31:16 AM

     
     
42         
43         %Try_Locale(EN_IE);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

9 The SAS System                Friday 31 July 2020 12:31:16 a.m.

     
     
44         
45         %Try_Locale(EN_IN);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

10 The SAS System                 Friday 31 July 2020 12:31:16 AM

     
     
46         
47         %Try_Locale(EN_JM);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

11 The SAS System               Friday, July 31, 2020 12:31:16 AM

     
     
48         
49         %Try_Locale(EN_MT);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

12 The SAS System                Friday, 31 July 2020 12:31:16 AM

     
     
50         
51         %Try_Locale(EN_NZ);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

13 The SAS System                Friday, 31 July 2020 12:31:16 AM

     
     
52         
53         %Try_Locale(EN_PH);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

14 The SAS System               Friday, July 31, 2020 12:31:16 AM

     
     
54         
55         %Try_Locale(EN_SG);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

15 The SAS System               Friday, 31 July, 2020 12:31:16 AM

     
     
56         
57         %Try_Locale(EN_US);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

16 The SAS System               Friday, July 31, 2020 12:31:16 AM

     
     
58         
59         %Try_Locale(EN_ZA);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

17 The SAS System                 Friday 31 July 2020 12:31:16 AM

     
     
60         
61         %Try_Locale(EN_ZW);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

18 The SAS System                 Friday 31 July 2020 12:31:16 AM

 

As I suspected, it's the LOCALE that controls the date and time formats at the top of the page in the SAS log.

 

Jim

 

View solution in original post

7 REPLIES 7
jimbarbour
Meteorite | Level 14

@Shmuel, I'm sorry, but I didn't follow you.  Which system option are you pointing me to?

 

Jim

Shmuel
Garnet | Level 18

@jimbarbour wrote:

@Shmuel, I'm sorry, but I didn't follow you.  Which system option are you pointing me to?

 

Jim


The link explains the AWSTITLE system option, which enables to "Replaces the default text in the main SAS title bar."

On a 2nd thought, I am not sure it changes the LOG title. 

Anyhow, it should be, if any, a system option used at configuration or sas invoking.

 

Can you compare the configuration files of the two servers ?

 

jimbarbour
Meteorite | Level 14

@SASKiwi, I thought of that too, but unfortunately not.  STIMEFMT controls the format of the contents of STIMER/FULLSTIMER.

 

For example notice how the timer format changes as I use different STIMEFMT options and settings in the below -- but notice that the format of the date and time at the top of each page changes not at all.

 

Jim

1 The SAS System                                                                                23:05 Thursday, July 30, 2020

1          %_eg_hidenotesandsource;
5          %_eg_hidenotesandsource;
28         
29         *OPTION	STIMEFMT=(YYMMDDD10. HMS TOD KB MEMFULL TSFULL NC TS FMT OPT);
30         OPTION	STIMEFMT=(YYMMDDD10. HMS TOD KB MEMFULL TSFULL NC TS);
31         DATA	_NULL_;
32         RUN;

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           2020-07-30 23:05:01 
      

33         
34         *OPTION	STIMEFMT=(NLDATM2. HMS TIMEAMPM KB MEMFULL TSFULL NC);
35         OPTION	STIMEFMT=(NLDATM2. HMS TOD KB MEMFULL TSFULL TS NC);
36         DATA	_NULL_;
37         RUN;

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           07/30/2020 23:05:01
      

38         
39         *OPTION	STIMEFMT=(NLDATMAP TOD KB MEMFULL TSFULL NC TS FMT OPT);
40         OPTION	STIMEFMT=(NLDATMAP HMS TIMEAMPM KB MEMFULL TSFULL NC TS);
41         DATA	_NULL_;
42         RUN;

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 30, 2020 11:05:01 PM
      

43         
44         
45         
2 The SAS System                                                                                23:05 Thursday, July 30, 2020
SASKiwi
PROC Star

@jimbarbour  - I checked the full list of options for controlling LOG appearance here and I don't see any other options that might be worth trying: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=lrcon&docsetTarget=n03qoi...

 

Maybe time to ask Tech Support?

jimbarbour
Meteorite | Level 14

@SASKiwi, thank you for checking.

 

Actually, being to stubborn to take "no" for an answer, I kept searching the documentation, and:  It's a combination of the LOCALE and DFLANG options that seems to work.

 

I wrote a little macro to demonstrate this (below).  What it does is try various settings of the LOCALE option and then sets the DFLANG to LOCALE.  

&Null	%MACRO	Try_Locale(Locale);
	OPTION	LOCALE	=	&Locale;
	OPTION	DFLANG	=	LOCALE;

	%PUT	&Nte2;

	DATA	_NULL_;
	RUN;

	%PUT	&Nte2;
	%PUT	&Nte2;
%MEND	Try_Locale;

 

When I execute the macro, supplying various settings of LOCALE, we can see the date and time formats change at the top of the page in the SAS log.  As it happens, when LOCALE=EN_GB, that's precisely what I wanted.  One has to be a little careful here.  The DFLANG could change the DATESTYLE.  Date style is MDY in the USA, but it is DMY in much of the rest of the world.

29         %Try_Locale(en_AU);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

2 The SAS System                 Friday, 31 July 2020 12:31:16 AM

     
     
30         
31         %Try_Locale(EN_BE);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

3 The SAS System             Friday 31 July 2020 00 h 31 min 16 s

     
     
32         
33         %Try_Locale(EN_BW);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

4 The SAS System                  Friday 31 July 2020 12:31:16 AM

     
     
34         
35         %Try_Locale(EN_CA);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

5 The SAS System                Friday, 31 July, 2020 12:31:16 AM

     
     
36         
37         %Try_Locale(EN_CB);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

6 The SAS System                Friday, July 31, 2020 12:31:16 AM

     
     
38         
39         %Try_Locale(EN_GB);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

7 The SAS System                    Friday, 31 July 2020 00:31:16

     
     
40         
41         %Try_Locale(EN_HK);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

8 The SAS System                Friday, 31 July, 2020 12:31:16 AM

     
     
42         
43         %Try_Locale(EN_IE);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

9 The SAS System                Friday 31 July 2020 12:31:16 a.m.

     
     
44         
45         %Try_Locale(EN_IN);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

10 The SAS System                 Friday 31 July 2020 12:31:16 AM

     
     
46         
47         %Try_Locale(EN_JM);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

11 The SAS System               Friday, July 31, 2020 12:31:16 AM

     
     
48         
49         %Try_Locale(EN_MT);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

12 The SAS System                Friday, 31 July 2020 12:31:16 AM

     
     
50         
51         %Try_Locale(EN_NZ);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

13 The SAS System                Friday, 31 July 2020 12:31:16 AM

     
     
52         
53         %Try_Locale(EN_PH);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

14 The SAS System               Friday, July 31, 2020 12:31:16 AM

     
     
54         
55         %Try_Locale(EN_SG);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

15 The SAS System               Friday, 31 July, 2020 12:31:16 AM

     
     
56         
57         %Try_Locale(EN_US);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

16 The SAS System               Friday, July 31, 2020 12:31:16 AM

     
     
58         
59         %Try_Locale(EN_ZA);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

17 The SAS System                 Friday 31 July 2020 12:31:16 AM

     
     
60         
61         %Try_Locale(EN_ZW);
     

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      Timestamp           July 31, 2020 12:31:16 AM
      

18 The SAS System                 Friday 31 July 2020 12:31:16 AM

 

As I suspected, it's the LOCALE that controls the date and time formats at the top of the page in the SAS log.

 

Jim

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 7 replies
  • 2347 views
  • 2 likes
  • 3 in conversation