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
Pyrite | Level 9

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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 12 replies
  • 5059 views
  • 2 likes
  • 5 in conversation