Help using Base SAS procedures

Please help in reading a comma delimited file.

Reply
Contributor
Posts: 40

Please help in reading a comma delimited file.

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,
Super Contributor
Posts: 578

Re: Please help in reading a comma delimited file.

Are the values quoted as well?
Contributor
Posts: 40

Re: Please help in reading a comma delimited file.

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,
Super Contributor
Posts: 578

Re: Please help in reading a comma delimited file.

I have no idea how to help...sorry.
PROC Star
Posts: 7,492

Re: Please help in reading a comma delimited file.

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
Super User
Posts: 11,343

Re: Please help in reading a comma delimited file.

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.
Trusted Advisor
Posts: 2,116

Re: Please help in reading a comma delimited file.

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
Super User
Posts: 10,044

Re: Please help in reading a comma delimited file.

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
Contributor
Posts: 28

Re: Please help in reading a comma delimited file.

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);
New User
Posts: 1

Re: Please help in reading a comma delimited file.

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
Ask a Question
Discussion stats
  • 9 replies
  • 167 views
  • 0 likes
  • 8 in conversation