proc import datafile='/data/bvd/unrar/Contact_info.txt' encoding='any'; out=contacts dbms=dlm replace; delimiter = '09'x; guessingrows=max;
I'm using this cline of code to import data, but it bombs because of the statement encoding='any'
Any clues why is it bombing?
The log is quite verbose about why it is not working:
1 proc import
2 datafile='/data/bvd/unrar/Contact_info.txt'
3 encoding='any';
--------
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, DATAFILE, DATATABLE, DBMS, DEBUG, FILE,
OUT, REPLACE, TABLE, _DEBUG_.
ERROR 76-322: Syntax error, statement will be ignored.
4 out=contacts
5 dbms=dlm
6 replace;
7 delimiter = '09'x;
8 guessingrows=max;
9 run;
SAS is not expecting "encoding" keyword there.
You can use the "encoding" in FILENAME statement:
filename F '/data/bvd/unrar/Contact_info.txt' encodeing='utf-8';
proc import
datafile=F;
out=contacts
dbms=dlm
replace;
delimiter = '09'x;
guessingrows=max;
run;
And for a text file I suggest you check out this list: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/nlsref/n1r7pnb91iybs9n1hgvsj7q09srd.htm rather "any".
Bart
Now you're just being lazy. 😈
You have to provide the OUT= data set name for proc import to create a data set.
@Satori wrote:
1036 filename C '/data/bvd/unrar/Contact_info.txt' encoding='any';
1037 proc import datafile=C;
ERROR: Output SAS data set must be provided.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.