BookmarkSubscribeRSS Feed
Satori
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?

3 REPLIES 3
yabwon
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';
     --------
     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

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"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



Satori
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.
ballardw
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.

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 432 views
  • 1 like
  • 3 in conversation