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
Amethyst | Level 16

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.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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