- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc import datafile='/home/u35263349/Product Sales_Candidate Attach 1_PresSE_013.csv'
out=ff.product_sales
dbms=csv;
delimiter=',';
guessingrows=max;
run;
1. I am struggling above error in sas on demand studio please find below csv attachment file
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Do you see where it says "no data in first 5 records"? Please investigate that.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
from first row how to solve this problem please do needful
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That's it, no additional parts of the log?
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
A SELECT statement in SQL must contain a FROM clause.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
please give fix this problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Do NOT use PROC IMPORT for text files, write your own data step where you have full control over all names and attributes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@BrahmanandaRao wrote:
it is csv file only
Which you read with a DATA step, period.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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