BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
4 REPLIES 4
deleted_user
Not applicable
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.
Cynthia_sas
SAS Super FREQ
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
deleted_user
Not applicable
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
Cynthia_sas
SAS Super FREQ
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

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