DATA Step, Macro, Functions and more

Date / Time Formatting Issue

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 17
Accepted Solution

Date / Time Formatting Issue

Hello Friends

 

I have the following programe.  Can you please help me whether is there any issue with this code?

 

DATA test5;
INFORMAT LASTNAME $20. DOB MMDDYY8. GENDER $1.;
INPUT ID LASTNAME $12. DOB mmddyy8. HEIGHT 2. WEIGHT 3. GENDER $1. AGE 2.;
FORMAT DOB MMDDYY8.;
DATALINES;
1 SMITH 1/23/66 68 144 M 26
2 JONES 3/14/60 78 202 M 32
3 DOE 11/26/47 62 99 F 45
4 WASHINGTON 8/1/70 66 101 F 22
Run;

PROC PRINT;
TITLE 'Example 3.1';
RUN;

 

 

Thanks in advance.

 


Accepted Solutions
Solution
‎05-28-2017 01:30 PM
PROC Star
Posts: 264

Re: Date / Time Formatting Issue

[ Edited ]

something like this should work. plesse look into this link which will help you understand . http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a003209907.htm

 

 

DATA test5;

informat lastname $12.;

INPUT ID LASTNAME $ DOB: mmddyy8. HEIGHT WEIGHT GENDER $ AGE ;

FORMAT DOB MMDDYY8.;

DATALINES;

1 SMITH 1/23/66 68 144 M 26

2 JONES 3/14/60 78 202 M 32

3 DOE 11/26/47 62 99 F 45

4 WASHINGTON 8/1/70 66 101 F 22

Run;

PROC PRINT;

TITLE 'Example 3.1';

RUN;

View solution in original post


All Replies
Solution
‎05-28-2017 01:30 PM
PROC Star
Posts: 264

Re: Date / Time Formatting Issue

[ Edited ]

something like this should work. plesse look into this link which will help you understand . http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a003209907.htm

 

 

DATA test5;

informat lastname $12.;

INPUT ID LASTNAME $ DOB: mmddyy8. HEIGHT WEIGHT GENDER $ AGE ;

FORMAT DOB MMDDYY8.;

DATALINES;

1 SMITH 1/23/66 68 144 M 26

2 JONES 3/14/60 78 202 M 32

3 DOE 11/26/47 62 99 F 45

4 WASHINGTON 8/1/70 66 101 F 22

Run;

PROC PRINT;

TITLE 'Example 3.1';

RUN;

Occasional Contributor
Posts: 17

Re: Date / Time Formatting Issue

Thanks a lot.  Highly appreciated.  This works.  

I will check out the link you provided for more info.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 116 views
  • 0 likes
  • 2 in conversation