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

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

6 REPLIES 6
Astounding
PROC Star

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.

ambakansaria
Calcite | Level 5

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.

Tom
Super User Tom
Super User

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.


 

Tom
Super User Tom
Super User

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.

Reeza
Super User

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 ;
ambakansaria
Calcite | Level 5

Thanks Reeza

 

After changing the slashes, it works fine

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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