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

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 !!!

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

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

View solution in original post

6 REPLIES 6
novinosrin
Tourmaline | Level 20

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
nathan0925
Calcite | Level 5

Hi,

 

I have tried so many times with both codes, and the log is below:

 

 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 data calculator;
74 infile "folders/myfolders\calculator.csv" dsd dlm=',' firstobs=2;
75 length artifactNumber 8 model $12 Country $12 Date 4 material $10 Length 8 Width 8 Height 8;
76 input artifactNumber model Country Date material Length Width Height;
77 run;
 
ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/folders/myfolders\calculator.csv.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.CALCULATOR may be incomplete. When this step was stopped there were 0 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
 
78
79 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
91
 
I really don't know what happened with my SAS. The story is that I use the VirtualBox on a Mac pro and default saving folder for this CSV file is here:   /Users/nathan/Desktop/myfolders/calculator.csv   but we know that SAS requires us to use "folders/myfolders\calculator.csv" to import formula, could you please share some insights if I'm incorrect please.

 

Cheers

Tom
Super User Tom
Super User

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;
Reeza
Super User
Post your log. You may have an encoding issue or it could have been the extra / at the end of your file path.
nathan0925
Calcite | Level 5

Hi,

 

the log is below:

 

 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 data calculator;
74 infile "folders/myfolders\calculator.csv" dsd dlm=',' firstobs=2;
75 length artifactNumber 8 model $12 Country $12 Date 4 material $10 Length 8 Width 8 Height 8;
76 input artifactNumber model Country Date material Length Width Height;
77 run;
 
ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/folders/myfolders\calculator.csv.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.CALCULATOR may be incomplete. When this step was stopped there were 0 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
 
78
79 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
91

 

Cheers

Meghna14
Fluorite | Level 6

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 6 replies
  • 1052 views
  • 0 likes
  • 5 in conversation