Reading a 'messy' text file in sas

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

Reading a 'messy' text file in sas

I am working on a project where I need to create a sas data set from a messy text file. The issue is, I need to skip certain lines from the body of  text file. If I had to skip rows at the top 'firstobs' will take care of that and for skipping the rows at bottom 'obs' will help. How about skipping say 68th through 70th row and 100 through 110th row?

Any  help /suggestion would be highly appreciated.

Thanks.


Accepted Solutions
Solution
‎07-24-2014 10:17 PM
Respected Advisor
Posts: 4,930

Re: Reading a 'messy' text file in sas

It depends a lot on the structure of the text file. Skipping specific lines could be as simple as

input var1 var2...;

if _n_ in (68:70, 100:110) then delete;

....

PG

PG

View solution in original post


All Replies
Super Contributor
Posts: 297

Re: Reading a 'messy' text file in sas

Please provide a sample of the data you are working with so that we can help you.

Solution
‎07-24-2014 10:17 PM
Respected Advisor
Posts: 4,930

Re: Reading a 'messy' text file in sas

It depends a lot on the structure of the text file. Skipping specific lines could be as simple as

input var1 var2...;

if _n_ in (68:70, 100:110) then delete;

....

PG

PG
Contributor
Posts: 66

Re: Reading a 'messy' text file in sas

Thanks PGStat. This is exactly what I want right now. However the 'Messy' text file that I have to handle right now has lot more issues. Will get back to you if my research fail to give a desired outcome.

Thanks again for the help!!!

🔒 This topic is solved and locked.

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

Discussion stats
  • 3 replies
  • 211 views
  • 0 likes
  • 3 in conversation