BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
DavideGuido
Calcite | Level 5

Hi community,

 

I'm running two sas codes for importing .csv file from web (below the two codes) but one is good, while the other returns an error although it is very similar (really only the .csv file and relative url is different). Is there someone is avaliable to help me and explain me the reason, please.

 

Many thanks in advance for any suggestion.

 

Best,

 

Davide

 
 
/*I state the libname*/
libname ESERCIZI "/home/u62978465/sasuser.v94";
 
and then I run the code for importing the .csv:
 
This code works:
filename csvFile url "https://raw.githubusercontent.com/PacktPublishing/Mastering-SAS-Programming-for-Data-Warehousing/mas..." termstr=crlf;
proc import datafile=csvFile out=esercizi.foo replace dbms=csv;
run;
 
 
This code does not work (just the .csv file and relative url path are changed in relation to the first code)
filename csvFile url "https://raw.githubusercontent.com/DavideGuido/SASrep/main/ab2.csv" termstr=crlf;
proc import datafile=csvFile out=esercizi.foo_git replace dbms=csv;
run;
 
 
The log error is this:
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
WORK.PARMS.PARMS.SLIST.
Unable to sample external file, no data in first 5 records.
ERROR: Import unsuccessful. See SAS Log for details.
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User


filename csvFile temp termstr=lf;
proc http url="https://raw.githubusercontent.com/DavideGuido/SASrep/main/ab2.csv" out=csvFile method=get;
run;
proc import datafile=csvFile out=foo replace dbms=csv;
delimiter=';';
run;

Ksharp_0-1673610991649.png

 

View solution in original post

4 REPLIES 4
ballardw
Super User

I think the important part of the Log is this:

Unable to sample external file, no data in first 5 records.

 

That means that there appears to be nothing matching what you told Proc Import to look for.

Run this and show what you get in the log:

filename csvFile url "https://raw.githubusercontent.com/DavideGuido/SASrep/main/ab2.csv" termstr=crlf;
data _null_;
   infile csvfile;
file print; input; put _infile_; run;

 I am seeing lots of ; not commas. You told proc Import that the data is comma separated.

Also it seems that there may be some malformed values, see the Id followed by 11;40 as an example.

CODICE_FISCALE;data_cont
ID1;32
ID2;41
ID3;42
ID4;35
ID5;43
ID6;36
ID7;46
ID8;36
ID9;36
ID10;28
ID
11;40
ID12;46
ID13;39
ID14;36
DavideGuido
Calcite | Level 5

Many thanks Ballardw.

 

I have just tried to run your code and the results is below:

 

CODICE_FISCALE;data_cont
ID1;32
ID2;41
ID3;42
ID4;35
ID5;43
ID6;36
ID7;46
ID8;36
ID9;36
ID10;28
ID11;40
ID12;46
ID13;39
ID14;36
ID15
;44
ID16;35
ID17;40
ID18;36
ID19;40
ID20;39
ID1;32
ID2;36
ID3;33
ID4;44
ID5;46
ID6;61
ID7;51
ID8;30
ID9;49
ID10;33
ID11;48
ID12;36
I
D13;33
ID14;32
ID15;36
ID16;44
ID17;41
ID18;34
ID19;33
ID20;51
ID1;32
ID2;56
ID3;39
ID4;35
ID5;37
ID6;32
ID7;39
ID8;41
ID9;47
ID10;5
3
ID11;39
ID12;42
ID13;41
ID14;41
ID15;35
ID16;35
ID17;59
ID18;40
ID19;41
ID20;35
ID1;38
ID2;45
ID3;44
ID4;43
ID5;37
ID6;40
ID7;36
I
D8;41
ID9;50
ID10;46
ID11;36
ID12;55
ID13;47
ID14;45
ID15;43
ID16;42
ID17;40
ID18;44
ID19;43
ID20;38
ID1;53
ID2;36
ID3;41
ID4;42
ID5
;39
ID6;38
ID7;35
ID8;39
ID9;37
ID10;45
ID11;32
ID12;34
ID13;39
ID14;38
ID15;35
ID16;39
ID17;41
ID18;45
ID19;41
ID20;36
ID1;35
ID2;4
0
ID3;28
ID4;32
ID5;26
ID6;37
ID7;45
ID8;40
ID9;40
ID10;37
ID11;48
ID12;44
ID13;39
ID14;43
ID15;42
ID16;50
ID17;41
ID18;43
ID19;42
I
D20;37
ID1;39
ID2;39
ID3;55
ID4;44
ID5;42
ID6;38
ID7;34
ID8;37
ID9;46
ID10;33
ID11;38
ID12;42
ID13;43
ID14;50
ID15;39
ID16;37
ID17;3
8
ID18;36
ID19;37
ID20;42
ID1;29
ID2;32
ID3;50
ID4;43
ID5;44
ID6;40
ID7;37
ID8;42
ID9;45
ID10;52
ID11;47
ID12;36
ID13;31
ID14;54
ID1
5;42
ID16;49
ID17;40
ID18;37
ID19;44
ID20;41
ID1;44
ID2;41
ID3;44
ID4;51
ID5;47
ID6;40
ID7;32
ID8;48
ID9;32
ID10;29
ID11;36
ID12;39

ID13;36
ID14;49
ID15;41
ID16;47
ID17;40
ID18;40
ID19;42
ID20;28
ID1;58
ID2;44
ID3;35
ID4;29
ID5;38
ID6;34
ID7;38
ID8;41
ID9;36
ID10;
38
ID11;40
ID12;43
ID13;40
ID14;42
ID15;33
ID16;43
ID17;33
ID18;48
ID19;42
ID20;41

  In addition, I have tried to import by adding the delimiter=";" option but it returns the same error.

Many thanks for the answer.

 

Best,

 

Davide

 

Ksharp
Super User


filename csvFile temp termstr=lf;
proc http url="https://raw.githubusercontent.com/DavideGuido/SASrep/main/ab2.csv" out=csvFile method=get;
run;
proc import datafile=csvFile out=foo replace dbms=csv;
delimiter=';';
run;

Ksharp_0-1673610991649.png

 

DavideGuido
Calcite | Level 5

It has worked. Perfect!! 

 

Many many thanks Ksharp for helping me.

 

Best,

 

Davide

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 437 views
  • 0 likes
  • 3 in conversation