Hi!
I am trying to import yet another .csv-File into SAS via the following code. I am getting really strange errors
although the line is supposed to end after 1. Yet it seems as if there are lots of numbers after "1." in the error report.
However if I open the .csv in the text editor, there is nothing... the first 2 lines (nr. 3 and 4) are.
Who can help?
Thx, Stefan
-------------------------------------------------------------------------------------------------------------------------------
440000836024;440-Giro-2911331-1;28336;262;197;440-K3-GIRO;0;(EUR) Euro;1
440000836024;440-Giro-2911331-1-2-Z;28336;0;0;440-K3-GIRO;0;(EUR) Euro;1
--------------------------------------------------------------------------------------------------------------------------------
15 /* Import der Adressrisiken */
16 data rwaar (drop = positionswert) ;
17 infile 'RWAAR.csv' dsd dlm=';' firstobs=3;
18 input fdb : 12.
19 c200 : $65.
20 kusa : $10.
21 positionswert : commaX18.
22 RWA : commaX18.
23 LFS : $20.
24 Nominal : commaX18.
25 Waehrung : $30.
26 Kurs : commaX8.;
27 run;
NOTE: The infile 'RWAAR.csv' is:
File Name=/export/lkri2sa/sas/user/ex26878/RWAAR.csv,
Owner Name=ex26878,Group Name=gg_w_unix,
Access Permission=rw-r--r--,
File Size (bytes)=114404
NOTE: Invalid data for Kurs in line 3 72-73.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
3 CHAR 440000836024;440-Giro-2911331-1;28336;262;197;440-K3-GIRO;0;(EUR) Euro;1. 73
ZONE 3333333333333333246762333333323333333333333333333243244543332455224776330
NUMR 440000836024B440D792FD2911331D1B28336B262B197B440DB3D792FB0B855290552FB1D
fdb=440000836024 c200=440-Giro-2911331-1 kusa=28336 positionswert=262 RWA=197 LFS=440-K3-GIRO Nominal=0 Waehrung=(EUR) Euro Kurs=.
_ERROR_=1 _N_=1
You can add the TERMSTR=CRLF option to the INFILE statement of your current code.
infile 'RWAAR.csv' dsd dlm=dlm firstobs=3 termstr=crlf;
Alternatively you can add it as a delimiter.
dlm=';'||'0d'x;
infile 'RWAAR.csv' dsd dlm=dlm firstobs=3;
You appear to be reading a DOS file on UNIX. The last charcter shown is the <CR> '0D'x
You can use the UNIX command dos2unix to convert the file to UNIX.
Or use a FILEREF with the TERMSTR opion.
FILENAME MYCSV 'RWAAR.csv' TERMSTR=CRLF;
Then use the FILEREF in PROC IMPORT.
I do not understand a word you are saying... I am working on Windows but SAS runs on Citrix. I have no idea how and where to use unix commands, or how to access unix anyway. Is there an other way?
You can add the TERMSTR=CRLF option to the INFILE statement of your current code.
infile 'RWAAR.csv' dsd dlm=dlm firstobs=3 termstr=crlf;
Alternatively you can add it as a delimiter.
dlm=';'||'0d'x;
infile 'RWAAR.csv' dsd dlm=dlm firstobs=3;
Thx a lot, Tom! That works!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: