Hi everyone,
my code is below:
data calculator;
infile "/folders/myfolders/sasuser.v94/calculator.csv/" delimiter=',' firstobs=2;
length artifactNumber 8 model $12 Country $12 Date 4 material $10 Length 4 Width 4 Height 4;
input artifactNumber model $ Country $ Date material $ Length Width Height;
run;
attached the dataset as well, could anyone help why it shows 0 rows please? and also how to import the decimal data into SAS please.
much appreciated !!!
I checked the file, saved again as CSV and the following worked
data calculator;
infile "C:\Users\d106808\Downloads\calculator.csv" dsd dlm=',' firstobs=2;
length artifactNumber 8 model $12 Country $12 Date 4 material $10 Length 8 Width 8 Height 8;
input artifactNumber model Country Date material Length Width Height;
run;
NOTE: The infile "C:\Users\d106808\Downloads\calculator.csv" is:
Filename=C:\Users\d106808\Downloads\calculator.csv,
RECFM=V,LRECL=32767,File Size (bytes)=1441,
Last Modified=08Sep2019:08:16:28,
Create Time=08Sep2019:08:08:56
NOTE: 28 records were read from the infile "C:\Users\d106808\Downloads\calculator.csv".
The minimum record length was 36.
The maximum record length was 58.
NOTE: The data set WORK.CALCULATOR has 28 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
I checked the file, saved again as CSV and the following worked
data calculator;
infile "C:\Users\d106808\Downloads\calculator.csv" dsd dlm=',' firstobs=2;
length artifactNumber 8 model $12 Country $12 Date 4 material $10 Length 8 Width 8 Height 8;
input artifactNumber model Country Date material Length Width Height;
run;
NOTE: The infile "C:\Users\d106808\Downloads\calculator.csv" is:
Filename=C:\Users\d106808\Downloads\calculator.csv,
RECFM=V,LRECL=32767,File Size (bytes)=1441,
Last Modified=08Sep2019:08:16:28,
Create Time=08Sep2019:08:08:56
NOTE: 28 records were read from the infile "C:\Users\d106808\Downloads\calculator.csv".
The minimum record length was 36.
The maximum record length was 58.
NOTE: The data set WORK.CALCULATOR has 28 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
Hi,
I have tried so many times with both codes, and the log is below:
Cheers
Read the log carefully. You asked it to read this file:
infile "folders/myfolders\calculator.csv" dsd dlm=',' firstobs=2;
And it is telling you that such a file does not exist:
ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/folders/myfolders\calculator.csv.
Since you provided a RELATIVE filename it looked for the file in the current working directory and could not find it.
So first fix you file to to use the complete path, starting with the root node of /.
Also make sure to use / as the separator between directory names. On Unix the backslash is used to protect the next character.
infile "/folders/myfolders/calculator.csv" dsd dlm=',' firstobs=2;
Hi,
the log is below:
Cheers
hi ,
it seems your '/' is a issue for path : folders/myfolders\calculator.csv" dsd dlm=',' firstobs=2;
try this : folders\myfolders \ calculator.csv" dsd dlm=',' firstobs=2;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.