Solved
Contributor
Posts: 30

# Data Set Help

[ Edited ]

data birthinfo1;
length name \$24. dob \$12. sex \$1.;
input name \$24. dob \$12. sex \$1. ;
/*put _all_;*/
datalines;
james cathryn 15/10/1991 F
john Paul Mathew Pich 12/4/1964 M
Abharam Lincoln 25/12/1966 M
Lan 22/02/1956 F
run;

Regards,

SJN

Accepted Solutions
Solution
‎07-01-2017 05:35 AM
Super User
Posts: 10,699

## Re: Data Set Help

data birthinfo1;
input ;
name=substr(_infile_,1,anydigit(_infile_)-1);
dob=scan(_infile_,-2,' ');
sex=scan(_infile_,-1,' ');
datalines;
james cathryn 15/10/1991 F
john Paul Mathew Pich 12/4/1964 M
Abharam Lincoln 25/12/1966 M
Lan 22/02/1956 F
;
run;

All Replies
Posts: 1,831

## Re: Data Set Help

Omit the dots at length statement.

The dots are needed in format statement.

data birthinfo1;
length name \$24 dob \$12 sex \$1;
input name \$24. dob \$12. sex \$1. ;
/*put _all_;*/
datalines;
james cathryn 15/10/1991 F
john Paul Mathew Pich 12/4/1964 M
Abharam Lincoln 25/12/1966 M
Lan 22/02/1956 F
run;
Solution
‎07-01-2017 05:35 AM
Super User
Posts: 10,699

## Re: Data Set Help

data birthinfo1;
input ;
name=substr(_infile_,1,anydigit(_infile_)-1);
dob=scan(_infile_,-2,' ');
sex=scan(_infile_,-1,' ');
datalines;
james cathryn 15/10/1991 F
john Paul Mathew Pich 12/4/1964 M
Abharam Lincoln 25/12/1966 M
Lan 22/02/1956 F
;
run;
☑ This topic is solved.

Discussion stats
• 2 replies
• 152 views
• 0 likes
• 3 in conversation