BookmarkSubscribeRSS Feed
sasbasls
Calcite | Level 5
Hi,

Please help me to read in data with comma as delimiter.

Issue is we are having comma's in the values for the variables and hence that whole value should be with same variable after read out using comma as file delimiter.

thanks,
9 REPLIES 9
DBailey
Lapis Lazuli | Level 10
Are the values quoted as well?
sasbasls
Calcite | Level 5
Nope that was the issue. Vendor just sent data as a csv file with comma as delimiter. And I see there are commas in few of the field values within.

thanks,
DBailey
Lapis Lazuli | Level 10
I have no idea how to help...sorry.
art297
Opal | Level 21
Can you post a copy of one record? Particularly, one record that has the extra commas, along with the header record (or at least an indication of what the fields are?

Art
ballardw
Super User
If you are looking at the file using Excel, or other spreadsheet program, I recommend looking at it using a text editor such as the SAS editor or Wordpad, or a viewer such as SAS FSLIST.

If you are seeing commas in the fields the quotes that are in the file are ignored by most of the programs that open CSV by default.
Doc_Duke
Rhodochrosite | Level 12
You probably need to go back to your vendor and get them to provide you with a new dataset that is either properly set out as a .csv file or to substitute another delimiter [tilde (~) and pipe (|) are pretty good choices and you an look for them in this copy of the file].

Doc Muhlbaier
Duke
Ksharp
Super User
Yes.I do not think it is a big problem,since SAS has very powerful of processing these data.
Could you post some dummy data and Explain what output do you want?


Ksharp
mojerry2
Fluorite | Level 6
dear,

If your vendor is giving you a scheme about what he's delivering then you should know the columns who have a comma type value.
When you know your columns you have two possibilities : concat first column with a comma and your second column and input(concatenated_column,commax10.3);

more tricky is if you know your second column contains hundreds for example then just tell sas value=column1+(column2/100);
sasmn
Calcite | Level 5
If your incoming data has commas as part of the data, modified list input might be useful. Here is a link from support.sas, scroll down until you read the Modified List Input section, http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a003209907.htm

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
  • 9 replies
  • 903 views
  • 0 likes
  • 8 in conversation