Hi All, This may be a quick one... I used to be very proficient in SAS and returning to it after some time off. As I recall, a CSV file (such as the one attached) which has a text variable surrounded by double quotes should have no problem being read by SAS even if it has commas in the text, as long as the DSD option is enable. Corresponding to the data I am uploading, which is a sample of public data from the CFPB, below is my import data step. Can someone explain to me why it is not working? It goes haywire on the second observation and sees a mid-text comma as a delimiter, rather than skipping it as a part of the quote. Help much appreciated as I shake this rust off... data WORK.TEST ; %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ infile '\\nera-dcfs\work\User\Alexander.Kfoury\Learning\Code Samples\CFPB\Sample 3.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ; informat Date_received $15. ; informat Product $16. ; informat Sub_product $39. ; informat Issue $38. ; informat Sub_issue $38. ; informat Consumer_complaint_narrative $1265. ; informat Company_public_response $48. ; informat Company $40. ; informat State $23. ; informat ZIP_code $5. ; informat Tags $2. ; informat Consumer_consent_provided_ $20. ; informat Submitted_via $3. ; informat Date_sent_to_company mmddyy10. ; informat Company_response_to_consumer $23. ; informat Timely_response_ $3. ; informat Consumer_disputed_ $3. ; informat Complaint_ID best32. ; format Date_received $15. ; format Product $16. ; format Sub_product $39. ; format Issue $38. ; format Sub_issue $38. ; format Consumer_complaint_narrative $1265. ; format Company_public_response $48. ; format Company $40. ; format State $23. ; format ZIP_code $5. ; format Tags $2. ; format Consumer_consent_provided_ $20. ; format Submitted_via $3. ; format Date_sent_to_company mmddyy10. ; format Company_response_to_consumer $23. ; format Timely_response_ $3. ; format Consumer_disputed_ $3. ; format Complaint_ID best12. ; input Date_received $ Product $ Sub_product $ Issue $ Sub_issue $ Consumer_complaint_narrative $ Company_public_response $ Company $ State $ ZIP_code $ Tags $ Consumer_consent_provided_ $ Submitted_via $ Date_sent_to_company Company_response_to_consumer $ Timely_response_ $ Consumer_disputed_ $ Complaint_ID ; if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */ run;
... View more