The SAS Output Delivery System and reporting techniques

Efficiently split CSV input data into array

Reply
N/A
Posts: 0

Efficiently split CSV input data into array

I am reading in a CSV file with several hundred comma separated items on each text line. I need to get all of the individual values for each text line into an array to work with. At the moment I am using the SCAN function to step through the text line and extract each item however with up to 300 items per line and more than 30,000 lines to scan I am finding that this is taking much longer to run than I would like.

Is there any SAS function which I am overlooking that could be used to perform this without having to loop through the text records for each item. For example in some of the EXCEL VBA work that I have done I have used the SPLIT function which separates each of the items in a text line into individual array items.

Thanks
Peter
N/A
Posts: 0

Re: Efficiently split CSV input data into array

Posted in reply to deleted_user
Please ignore this request. If had simply split the data into an array at the time of input I wouldn't have needed to do this.
SAS Super FREQ
Posts: 8,868

Re: Efficiently split CSV input data into array

Posted in reply to deleted_user
Hi:
This is not really an ODS or Base Reporting procedure question. There are some previous forum postings that involved ARRAY discussions:
http://support.sas.com/forums/thread.jspa?messageID=7268ᱤ
http://support.sas.com/forums/thread.jspa?messageID=2555৻
http://support.sas.com/forums/thread.jspa?messageID=4665ሹ

For more help with the ARRAY statement or with processing your CSV file, you might consider contacting Tech Support.

cynthia
N/A
Posts: 0

Re: Efficiently split CSV input data into array

Posted in reply to Cynthia_sas
Thanks for the response Cynthia.

I have worked with arrays quite extensively over the past 15 years, although it is always good so see some alternative was of doing things. It was really the splitting of items into an array with the least possible amount of CPU processing that I was after.

While I agree this was not an ODS or Base Reporting Procedure question, I also don't see a forum for general SAS questions that really relate to SAS Base.

Regards
Peter
SAS Super FREQ
Posts: 8,868

Re: Efficiently split CSV input data into array

Posted in reply to deleted_user
Hi, Peter,
You're right, there is no general forum for Base SAS questions. Most of the kinds of questions that come in regarding Base SAS are best answered by Tech Support.

cynthia
Ask a Question
Discussion stats
  • 4 replies
  • 151 views
  • 0 likes
  • 2 in conversation