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

Hi when i use the below mentioned sas code to access the data, it throws the error-physical file does not exist. I am using sas studio. and have added the text data into my sas folder. 

  I have attached the file showing the error.

Do is need to add anything else.

data price;
infile="/folders/myfolders/data_infile.txt";
input brand $ model $ price;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

@subhra07 wrote:

Have tried with the full path and got error too.

this is the code

data price;
infile="F:\SASUniversityEdition\myfolders\data_infile.txt" dlm = '09'x;
input brand $ model $ price;
run;


This can never work in UE, as the virtual machine only "sees" the UNIX file system.

Have you tried '/folders/myfolder/data_infile.txt'? (if set up correctly, the shared folder has no trailing s in the VM)

View solution in original post

12 REPLIES 12
rudfaden
Lapis Lazuli | Level 10

If you right click on the files and choose properties, you can see the file location

subhra07
Fluorite | Level 6

Have tried with the full path and got error too.

this is the code

data price;
infile="F:\SASUniversityEdition\myfolders\data_infile.txt" dlm = '09'x;
input brand $ model $ price;
run;

Kurt_Bremser
Super User

@subhra07 wrote:

Have tried with the full path and got error too.

this is the code

data price;
infile="F:\SASUniversityEdition\myfolders\data_infile.txt" dlm = '09'x;
input brand $ model $ price;
run;


This can never work in UE, as the virtual machine only "sees" the UNIX file system.

Have you tried '/folders/myfolder/data_infile.txt'? (if set up correctly, the shared folder has no trailing s in the VM)

subhra07
Fluorite | Level 6

Yes I have tried that and it worked fine. 

One more doubt. Will it work the same way '/folders/myfolder/data_infile.txt' in SAS enterprise guide or do i have to give the full path "F:\SASUniversityEdition\myfolders\data_infile.txt" dlm = '09'x

 

Thanks 

Kurt_Bremser
Super User

@subhra07 wrote:

Yes I have tried that and it worked fine. 

One more doubt. Will it work the same way '/folders/myfolder/data_infile.txt' in SAS enterprise guide or do i have to give the full path "F:\SASUniversityEdition\myfolders\data_infile.txt" dlm = '09'x

 

Thanks 


You can't use Enterprise Guide with University Edition.

Apart from that, it always depends on where the SAS process itself runs, and how files are brought into the respective server environment.

subhra07
Fluorite | Level 6

I am not using EG with university edition.

the EG is working with office server. 

I would like to know if we could import text files using the infile statement. And if so, what would be the code like?

Thanks.

Tom
Super User Tom
Super User

@subhra07 wrote:

I am not using EG with university edition.

the EG is working with office server. 

I would like to know if we could import text files using the infile statement. And if so, what would be the code like?

Thanks.


The INFILE statement works the same no matter where SAS is running.

 

But you do need to understand where your files are on the machine where SAS itself is running.  If it is not machine where your browser or SAS Enterprise Guide is running then the path you use in SAS will most likely be different than what you would use on your PC.  Also remember that SAS University Edition is using a virtual machine to run SAS.

Kurt_Bremser
Super User

@subhra07 wrote:

I am not using EG with university edition.

the EG is working with office server. 

I would like to know if we could import text files using the infile statement. And if so, what would be the code like?

Thanks.


What @Tom said. You need to somehow make the file "visible" to the SAS process, either by copying it to the server, or using a shared resource that is accessible by both your desktop and the server, or by using a resource shared from the server that is mounted on your desktop. Either way, the path will be different from what you use on your PC.

subhra07
Fluorite | Level 6

Have got the solution. There should not be equal sign after infile statement

Kurt_Bremser
Super User

@subhra07 wrote:

Have got the solution. There should not be equal sign after infile statement


Ouch. At least one of us should have caught that immediately. Going for additional coffee.

nirupama1
Fluorite | Level 6

Hi All,

 

I used below codes  i.e. with Tilde and without tilde(~). And getting the same result . Can yo explain why is it so?

 case1-

Data student;
infile cards dsd dlm=',';
Input id team $25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;
proc print;
Run;

 

case 2-

Data student;
infile cards dsd dlm=',';
Input id team ~ $25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;
proc print;
Run;

 

same outputfor both cases-

 

id            team

1"Green House,NCSS"
2"Green House,ABPS"
3"Green House,JKLM"

 

 

While I expect to not receive quotes in output for case 1 scenario, as per the DSD fuctionality.

PLease explain Why getting same output.

 

Thanks,

Nirupama

Kurt_Bremser
Super User

@nirupama1 wrote:

Hi All,

 

I used below codes  i.e. with Tilde and without tilde(~). And getting the same result . Can yo explain why is it so?

 case1-

Data student;
infile cards dsd dlm=',';
Input id team $25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;
proc print;
Run;

 

case 2-

Data student;
infile cards dsd dlm=',';
Input id team ~ $25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;
proc print;
Run;

 

same outputfor both cases-

 

id            team

1 "Green House,NCSS"
2 "Green House,ABPS"
3 "Green House,JKLM"

 

 

While I expect to not receive quotes in output for case 1 scenario, as per the DSD fuctionality.

PLease explain Why getting same output.

 

Thanks,

Nirupama


Do not hijack other people's threads, post your question in a new one. Old questions are only "seen" by the original participants.

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 12 replies
  • 6214 views
  • 2 likes
  • 5 in conversation