04-26-2013 03:02 AM
until yesterday my data provider sent me a csv file and I was able to read it with the following data step:
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.;
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?
04-26-2013 11:00 AM
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.