BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
BrahmanandaRao
Lapis Lazuli | Level 10
proc import datafile='/home/u35263349/Product Sales_Candidate Attach 1_PresSE_013.csv'
out=ff.product_sales
dbms=csv;
delimiter=',';
guessingrows=max;
run;

Anandkvn_0-1682447644773.png

1. I am struggling above error  in sas on demand studio  please find below csv attachment file 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The file appears to be using a Carriage Return character to end the lines in the file. I think from your syntax that you are running your code in SAS On Demand which is a Linux implementation and expects either a Line Feed or can use the Windows CRLF line terminator.

 

Try

filename in  "/home/u35263349/Product Sales_Candidate Attach 1_PresSE_013.csv" Termstr=CR;

proc import datafile=in
out=product_sales
dbms=csv;
delimiter=',';
guessingrows=max;
run;

Proc Import doesn't support the Termstr= option directly but the Filename does. So you can add that option as above.

View solution in original post

20 REPLIES 20
PaigeMiller
Diamond | Level 26

Do you see where it says "no data in first 5 records"? Please investigate that.

--
Paige Miller
BrahmanandaRao
Lapis Lazuli | Level 10
i open and check csv checked but shows
from first row how to solve this problem please do needful
PaigeMiller
Diamond | Level 26

As I recall, when you run PROC IMPORT on a CSV file, SAS creates code and executes it and this code and other error messages appears in the log. But you don't show us that code in the log. Show us.

--
Paige Miller
BrahmanandaRao
Lapis Lazuli | Level 10
I put log error snap shot
PaigeMiller
Diamond | Level 26

That's it, no additional parts of the log?

--
Paige Miller
ballardw
Super User

The file appears to be using a Carriage Return character to end the lines in the file. I think from your syntax that you are running your code in SAS On Demand which is a Linux implementation and expects either a Line Feed or can use the Windows CRLF line terminator.

 

Try

filename in  "/home/u35263349/Product Sales_Candidate Attach 1_PresSE_013.csv" Termstr=CR;

proc import datafile=in
out=product_sales
dbms=csv;
delimiter=',';
guessingrows=max;
run;

Proc Import doesn't support the Termstr= option directly but the Filename does. So you can add that option as above.

BrahmanandaRao
Lapis Lazuli | Level 10
Thank you vey much for your solution now i can import file succefully
but in that file variable have embadded blanks
in log it shows error even if validname=v7 option

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 proc sql;
70 select * from product_sales_ds
71 where POS Consumer Price=0;
________
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &, (, *, **, +, -, '.', /, <, <=, <>, =, >, >=, ?, AND,
BETWEEN, CONTAINS, EQ, EQT, EXCEPT, GE, GET, GROUP, GT, GTT, HAVING, IN, INTERSECT, IS, LE, LET, LIKE, LT, LTT, NE,
NET, NOT, NOTIN, OR, ORDER, OUTER, UNION, ^, ^=, |, ||, ~, ~=.

ERROR 76-322: Syntax error, statement will be ignored.

NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
72 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 276.90k
OS Memory 27540.00k
Timestamp 26/04/2023 04:39:55 AM
Step Count 414 Switch Count 0
Page Faults 0
Page Reclaims 14
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0

73
74
75 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
85

proc sql;
select * from product_sales_ds
where POS Consumer Price=0;
quit;
BrahmanandaRao
Lapis Lazuli | Level 10
i have embadded blanks for all below vairables how to add uderscore between embadded blanks even if i used options validvarname=v7 option and proc import
please give fix this problem
BrahmanandaRao
Lapis Lazuli | Level 10
options validvarname = V7;
filename psales "/home/u35263349/Product Sales_Candidate Attach 1_PresSE_013.csv"  termstr=cr;


proc import file=psales dbms=csv out=product_sales_ds replace;
run;

issue is blanks within variables names please find attachment

Kurt_Bremser
Super User

Please READ my posts. Do NOT use PROC IMPORT.


@BrahmanandaRao wrote:
options validvarname = V7;
filename psales "/home/u35263349/Product Sales_Candidate Attach 1_PresSE_013.csv"  termstr=cr;


proc import file=psales dbms=csv out=product_sales_ds replace;
run;

issue is blanks within variables names please find attachment


 

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 25. 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
  • 20 replies
  • 2876 views
  • 1 like
  • 5 in conversation