08-11-2016 09:57 AM
I am facing an error( ERROR: File WORK.MYCSV.DATA does not exist.)
while running the below mentioned code
PROC IMPORT DATAFILE='/folders/myfolders/Car_sales.csv';
/** Print the results. **/
PROC PRINT DATA=WORK.MYCSV; RUN;
COuld you please help me with this.
08-11-2016 10:02 AM
Post your log.
Remember that SAS Studio is case sensitive on the file name in proc import.
The best way to make sure the path is correct is to navigate to the file in Files, Folders and Servers pane on right hand side, right click file, select properties and copy path from there.
08-11-2016 10:11 AM
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 55 56 57 58 /** FOR CSV Files uploaded from Windows **/ 59 60 FILENAME CSV "" TERMSTR=CRLF; 61 62 /** FOR CSV Files uploaded from Unix/MacOS **/ 63 64 FILENAME CSV "" TERMSTR=LF; 65 66 /** Import the CSV file. **/ 67 68 PROC IMPORT DATAFILE='/folders/myfolders/Car_sales.csv'; ERROR: Output SAS data set must be provided. NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE IMPORT used (Total process time): real time 0.01 seconds cpu time 0.00 seconds 69 70 OUT=WORK.MYCSV 71 DBMS=CSV 72 REPLACE; 73 RUN; 74 75 /** Print the results. **/ 76 77 PROC PRINT DATA=WORK.MYCSV; RUN; ERROR: File WORK.MYCSV.DATA does not exist. NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE PRINT used (Total process time): real time 0.02 seconds cpu time 0.02 seconds 78 79 /** Unassign the file reference. **/ 80 81 FILENAME CSV; NOTE: Fileref CSV has been deassigned. 82 83 84 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 96
08-11-2016 10:25 AM
You have put a semicolon before the out= statement. Let me correct your code and also apply some code formatting:
proc import datafile='/folders/myfolders/Car_sales.csv' out=work.mycsv dbms=csv replace; run; /** print the results. **/ proc print data=work.mycsv; run;
You will note the semicolo appears after the replace only. Position of that is key.
08-12-2016 01:12 AM
now having problem in running this
where Vehicle_type="Passenger" and Latest_Launch >= '01oct2014'd;
08-12-2016 01:22 AM
The errors pretty clear. One of your variables in where clause is the issue.
By compatible variables it means they should be the same type, ie character variables need quotes and date variables need date values.
So run a proc contents on your input data set, r.car_sales, and see what the type and formats are and make sure your where clause is correct.
Things that could be the issue - vehicle type is numeric but has a format applied that allows it to appear as character. In this case you can either find out what the underlying value of the variable is or convert it to character in the where clause.
Or your date variable is actually a character field.