BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,

I have a CSV file to read & I'm wondering if anyone can help. Here are the features of the file:

1. The file contains two types of record - one starting with 'H' and the other starting with 'R' - they are in different format so I have to read them into separate datasets. I used '@' to determine the type of the record and created two datasets (one for H and one for R)

2. The H record contains about 85 variables to read. Some are missing (especially the last one) so I used DLM=',', DSD and MISSOVER option. The problem is - the H record's length can vary depends on the record and it stops at the first 200th columns and continue on the next line. So for example - if the end of the first line contains a time variable (11:35), it cuts off at 200th and continue on the next line therefore messing up the data. (ie. 1 (at 200th column of the first line) and 1:35 (the start of the second line) for 11:35). This record could continue to the third line as well if the record is really long.

Does anybody see a possible solution to this???
Thanks.

James
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi!
This is not an ODS/Reporting issue, so much as it is a DATA step/INFILE/INPUT issue. Tech Support is probably your best bet for help with this problem as they can actually look at your data file and come up with the appropriate suggestions.

For example, on some operating systems, you can put an LRECL= option on your INFILE statement to increase the size of the buffer for reading the "raw" data. You can also use the LENGTH= option in order to create a variable that tells you the length of the current "line of data" in the buffer. Then, you can use that Length variable with the VARYING informat in order to read the correct length of the record and not go over to the next line. In addition there are some other options you can specify on the INFILE statement that might help you, but it really depends a lot on your operating system, your data, etc.

The folks in Tech Support are the best ones to help you with this problem. To contact Tech Support, refer to:
http://support.sas.com/techsup/contact/index.html

Good luck!
cynthia

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 575 views
  • 0 likes
  • 2 in conversation