DATA Step, Macro, Functions and more

infile error in SAS university edition

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

infile error in SAS university edition

Hi

i am new to SAS programming and formed a simple program in SAS university edition

 

data vishal
infile "\folders\myfolders\v\vvv.txt" ;
input gener $ age weight ;
run ;

 

title "frequency" ;
proc freq data=vishal;
tables gender;
run;

 

I am getting error

 

Error no dataline or infile statement

Error extension for physical file  "\folders\myfolders\v\vvv.txt" does not corresponds to a valid member type.

 

Please help in solving this,

Attachement contains snapshots.

 


Accepted Solutions
Solution
‎09-21-2017 01:48 PM
Super User
Posts: 19,855

Re: infile error in SAS university edition

Posted in reply to ambakansaria

Generally the slashes are the opposite way, but SAS should still interpret it correctly.

 

Please include your FULL log in future questions. It's easy to make a typo and the log shows exactly where the error occurs.

 

data vishal;

infile "/folders/myfolders/v/vvv.txt" ;

input gender $ age weight ;

run ;

View solution in original post


All Replies
Super User
Posts: 5,516

Re: infile error in SAS university edition

Posted in reply to ambakansaria

You're missing a semicolon at the end of the DATA statement:

 

data vishal;

 

Also note, you changed the spelling of one variable (gener vs. gender).  You will need to make that consistent.

New Contributor
Posts: 3

Re: infile error in SAS university edition

Posted in reply to Astounding

hi 

 

Applied semicolon at the data statement and run again, but it show below error.

 

Physical file does not exist /opt/sasinside/SASConfig/lev1/SASApp/\folders\myfolders\v\vvv.txt.

Super User
Super User
Posts: 7,074

Re: infile error in SAS university edition

Posted in reply to ambakansaria

Unix uses / as the delimiters between directories in a path. It is Windows that uses \.

So the error message is just saying that there is no file in the current directory '/opt/sasinside/SASConfig/lev1/SASApp/' with then name '\folders\myfolders\v\vvv.txt'.

Use the real path to the file instead.

'/folders/myfolders/v/vvv.txt'

That error is suprising to me as normally SAS happily converts the directory delimiters for you.

Perhaps it cannot do that when you do not start the filename with a / or a valid relative directory name?


ambakansaria wrote:

hi 

 

Applied semicolon at the data statement and run again, but it show below error.

 

Physical file does not exist /opt/sasinside/SASConfig/lev1/SASApp/\folders\myfolders\v\vvv.txt.


 

Super User
Super User
Posts: 7,074

Re: infile error in SAS university edition

Posted in reply to ambakansaria

Because of the missing semi colon SAS thinks your data step whats to create three output datasets.

data vishal infile "\folders\myfolders\v\vvv.txt" ;

So the first two, visha1 and infile, are just normal membernames and so will default to the WORK library.  But the last one is a quoted physical filename. It is complaining that you want to use .txt as the extension on your dataset as SAS requires that it be .sas7bdat instead.

Then since you do not have an INFILE statement SAS will also complain that the INPUT statement has no where to find the data lines.

Solution
‎09-21-2017 01:48 PM
Super User
Posts: 19,855

Re: infile error in SAS university edition

Posted in reply to ambakansaria

Generally the slashes are the opposite way, but SAS should still interpret it correctly.

 

Please include your FULL log in future questions. It's easy to make a typo and the log shows exactly where the error occurs.

 

data vishal;

infile "/folders/myfolders/v/vvv.txt" ;

input gender $ age weight ;

run ;
New Contributor
Posts: 3

Re: infile error in SAS university edition

Thanks Reeza

 

After changing the slashes, it works fine

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 100 views
  • 2 likes
  • 4 in conversation