BookmarkSubscribeRSS Feed
sy2011
Calcite | Level 5
Hi,

Can I use PROC IMPORT to import delimited text file which contains a lots of comment lines at the beginning of the file. The comment lines are marked with "#"s. I want to exclude the comment lines and start to import at the header line.

Thanks.

sy
6 REPLIES 6
ballardw
Super User
Single input file or multiple input files with varying numbers of comment lines?
sy2011
Calcite | Level 5
I've resolved the problem. Thank you for your reply.
sy2011
Calcite | Level 5
Thank you for all your replies. I've resolved the problem by using DBailey's approach, i.e., I used substr( ) to delete the lines with #s in the DATA step.
Ksharp
Super User
It seems that proc import cann't do it, But Import Data Wizard in sas menu can choose the start row of data. Maybe it is not what you want.


Ksharp
DBailey
Lapis Lazuli | Level 10
You could always fall back and write your own data step to check the first character of the line before parsing and outputting the data set.
sss
Fluorite | Level 6 sss
Fluorite | Level 6
HI
I am not sure about the wizard but you can do by code

data dataset_name;
infile 'path\file.txt' dlm='#&*';
input var1$ var2 ;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 6 replies
  • 905 views
  • 0 likes
  • 5 in conversation