BookmarkSubscribeRSS Feed
Quartz | Level 8
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?

Onyx | Level 15

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';
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 
delimiter = '09'x; 

And for a text file I suggest you check out this list: rather "any".



Polish SAS Users Group: and

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation

Quartz | Level 8
1036 filename C '/data/bvd/unrar/Contact_info.txt' encoding='any';
1037 proc import datafile=C;
ERROR: Output SAS data set must be provided.
Super User

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 out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.


Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1 like
  • 3 in conversation