Dollar symbol in a csv file

Posts: 58

Dollar symbol in a csv file


until yesterday my data provider sent me a csv file and I was able to read it with the following data step:

              data dates;

                infile "&readfilename."

                       lrecl=32767 firstobs=2 dsd dlm=',' obs=2;

                if _n_=1 then input a $ b $ c $ d $ e $ f $ g @;

                input dat : ddmmyy10. @@;

                format dat ddmmyy10.;

                keep dat;


Since yesterday my data provider sent me the csv with the same structure but in some rows there are some string containing the dollar symbol "$" and the data step crash, it seems that it is due to the presence of $.

Do there is a way to avoid error reading a file with dollar symbol inside?

Many thanks.


Super User
Posts: 10,787

Re: Dollar symbol in a csv file

Plz provide some sample data.

Super User
Posts: 13,583

Re: Dollar symbol in a csv file

If the datastep "crashes" are there any error messages in the LOG? That would also help diagnose the problem. As well as an example line or two of data.

$ should only cause a problem normally if the variable is numeric such as your variable g or cannot be handled by the informat, such as your DAT variable. If those are the ones with problems I would also look at the data to see if the number of columns actually matches your input statement. You might have a case where they have changed a field so that it has imbedded commas such as $5,600.15 and the value is reading $5 for one variable but the comma in the field has thrown off the column count and for that row there are one or more additional values and then the "g" and/or DAT variables are attempting to read invalid data.

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation