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.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.