Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SAS: How to conver COMP3 date and time to user defined forma

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
Laxminarsimharao

New User


Joined: 08 May 2007
Posts: 26
Location: hyderabad

PostPosted: Wed Oct 31, 2007 9:44 pm    Post subject: SAS: How to conver COMP3 date and time to user defined forma
Reply with quote

Problem:
Date: 107292 (In COMP3 size 5)
Time: 103352 (In COMP3 size 4)

how can i convert the above values into normal date DDMMYY and HH:MM:SS in SAS PRINT procedure?

please help me.
Back to top
View user's profile Send private message

cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Thu Nov 01, 2007 1:09 am    Post subject: Reply to: SAS: How to conver COMP3 date and time to user def
Reply with quote

Here is the input displayed in HEX (in TSO). DATE in position1 and TIME in position 11:

Code:

----+----1----+
----+----F----+
----+----1----+
---------------
         
000224444403324
0179F00000015F0


We will assume that 107292 is the numeric equivalent of the date. 103352 is an invalid time, so I used 031352.

Here is the SAS code:

Code:

//XSAS1 EXEC SAS RSYSOUT='*',LSYSOUT='*'                   
//SAS.SASLIST  DD SYSOUT=*                                 
//SAS.SASLOG   DD SYSOUT=*                                 
//SAS.INDATE   DD DSN=HLQ.SAS.TEST,DISP=SHR               
//SYSIN DD *                                               
  DATA PROD1;                                               
     INFILE INDATE;                                         
     INPUT  @01 DATE    PD5.                               
            @11 TIME    PD4.;                               
             DATEX = PUT(DATE,DDMMYY6.);                     
            TIMEX = PUT(TIME,TIME8.);                       
  PROC PRINT DATA=PROD1;                                   


So we bring in the DATE and the TIME indicating packed decimal format.
We then take the DATE and TIME and PUT them into a FORMAT (see DATEX and TIMEX).

The printout looks like:

Code:

               The SAS System               
                                             
Obs     DATE      TIME    DATEX      TIMEX   
                                             
 1     107292    31352    031053    8:42:32 


So the DATE of 107292 converts to MMDDYY or 03/10/53 (without the slashes) and the TIME of 031352 converts to 8:42:32.

If you are doing this in a SAS PRINT procedure, you could use something like:

Code:

PROC PRINT DATA=PROD1 NOOBS UNIFORM LABEL;               
TITLE1 'DATE AND TIME';
   FORMAT DATE MMDDYY6.;                                 
   FORMAT TIME TIME8;
       LABEL DATE  ='THE DATE'                           
         TIME = 'THE TIME';                           
        VAR DATE TIME;                 
Back to top
View user's profile Send private message
Laxminarsimharao

New User


Joined: 08 May 2007
Posts: 26
Location: hyderabad

PostPosted: Fri Nov 02, 2007 7:47 pm    Post subject: Reply to: SAS: How to conver COMP3 date and time to user def
Reply with quote

Thank you cpuhawg.

can you help me out how can we convert the 107306 (COMP3) to 02NOV2007 in SAS PRINT procedure ?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Nov 02, 2007 8:40 pm    Post subject:
Reply with quote

Laxminarsimharao
Do you not have your own set of manuals at the shop you work in ? They can be accessed freely at www.sas.com

Take a look at FORMATS in the manuals and your question will be answered.

Are the variables you are using generated by SAS, or merely to be converted by SAS to a different format. SAS uses a base point for its date routines, and if these variables are not SAS generated then you will need to find the base point of these variables and adapt them to fit in with the SAS base point.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Regarding time parameter shanthi gude JCL & VSAM 7 Mon Sep 04, 2017 2:31 pm
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us