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

Hello everyone, I'm a beginner at SAS, so I am having trouble reading a text file. I dont know how to read this text file because it keeps skipping over the height column in my out put. the code and output are below. any advice? thanks in advance! 

 

The Text files looks like this :  

J,08,2,1,02/08/1998,74,280,1.9,4.3,6

J,11,1, ,12/14/1997,66,169,3.5,3.3,5.2

R,16,1,1,12/27/1997,70,233,1.6,1.6

R,09,2,2,12/27/1997,74,387,4.4,1.5,2

J,06,1,2,01/03/1998,64,210,4,4.2,4.4

J,10,1,2,01/03/1998,68,258,10.3,9,5.2

R,15,1,2, ,70,172,6.3

J,07,2,3,01/10/1998,74,177,2.3,3.4,4.5

J,09,2,3,01/11/1998,72,185,1.4,1.4,1.4

J,12,2,3,01/17/1998,76,358,3.9,5,7.6

R,08,2,3,01/24/1998,72,386,4,5.1

R,10,2,3,02/21/1998,62,152,6

J,14,1,3,01/04/1998,69,195,7.8,1.3,5.6

R,24,1,3,02/07/1998,67,212,1.8,2.3,2.3

J,13,1,4,01/31/1998,63,204,4.7,7.3,1

 

The Code looks like this: 

data study;
	infile "...." TRUNCOVER;
	input
Site :$1. Pt :$2. Sex :8. Race :8. Dosedate mmddyy10. Height :8. Weight :8. Result1 :8. Result2 :8. Result3 :8.;
format Dosedate mmddyy10.;
Run;

Here is the output: 

Screen Shot 2020-07-06 at 12.32.35 PM.png

 

anyone know why height isnt being read? 

1 ACCEPTED SOLUTION

Accepted Solutions
ketpt42
Quartz | Level 8

This is working for me:

 

data study;
    infile "/folders/myfolders/data.txt"  dsd missover;
    input
Site :$1. Pt :$2. Sex :8. Race :8. Dosedate :mmddyy10. Height :8. Weight :8. Result1 :8. Result2 :8. Result3 :8.;
format Dosedate mmddyy10.;

Run;

Mainly I added a colon after Dosedate on your input statement.

View solution in original post

5 REPLIES 5
Reeza
Super User
You'll need to post a few lines of the text file. Is it a delimited or a fixed width file?
ER1C
Fluorite | Level 6

post edited! 

ER1C
Fluorite | Level 6

J,08,2,1,02/08/1998,74,280,1.9,4.3,6

J,11,1, ,12/14/1997,66,169,3.5,3.3,5.2

R,16,1,1,12/27/1997,70,233,1.6,1.6

R,09,2,2,12/27/1997,74,387,4.4,1.5,2

J,06,1,2,01/03/1998,64,210,4,4.2,4.4

J,10,1,2,01/03/1998,68,258,10.3,9,5.2

R,15,1,2, ,70,172,6.3

J,07,2,3,01/10/1998,74,177,2.3,3.4,4.5

J,09,2,3,01/11/1998,72,185,1.4,1.4,1.4

J,12,2,3,01/17/1998,76,358,3.9,5,7.6

R,08,2,3,01/24/1998,72,386,4,5.1

R,10,2,3,02/21/1998,62,152,6

J,14,1,3,01/04/1998,69,195,7.8,1.3,5.6

R,24,1,3,02/07/1998,67,212,1.8,2.3,2.3

J,13,1,4,01/31/1998,63,204,4.7,7.3,1

ketpt42
Quartz | Level 8

This is working for me:

 

data study;
    infile "/folders/myfolders/data.txt"  dsd missover;
    input
Site :$1. Pt :$2. Sex :8. Race :8. Dosedate :mmddyy10. Height :8. Weight :8. Result1 :8. Result2 :8. Result3 :8.;
format Dosedate mmddyy10.;

Run;

Mainly I added a colon after Dosedate on your input statement.

ER1C
Fluorite | Level 6

wow, thank you so much! 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 803 views
  • 2 likes
  • 3 in conversation