BookmarkSubscribeRSS Feed
KevinC_
Fluorite | Level 6
Hello all,

I have a delimited input file with close to 100 fields. i would like to append data to the end of each row. But i don't want to define each of the 100 fields in the input section. in addition, since it's a delimited file, each row has different length. Is there a way to skip to the end of each row from an input file when reading it?

Thanks for any input!
kevin
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Using a DATA step, it is possible to read up the current data record using an INFILE and INPUT statement, and then address it with the SAS reserved variable _INFILE_ for whatever purpose you might require. A very simple SAS DATA step is listed below for your review/consideration.

Also, the INFILE statement has parameters you can code to identify the record length, current column pointer location -- review the SAS Language INFILE discussion for details.

Scott Barry
SBBWorks, Inc.

data _null_;
infile datalines dsd truncover dlm=',';
input @;
putlog _all_ / _infile_;
cards;
a,b,c,d
e,f,g,h
run;
ChrisNZ
Tourmaline | Level 20
Or you could skip n fields by reading past them:
[pre]
input var1-varn $ @;
drop var:;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 591 views
  • 0 likes
  • 3 in conversation