BookmarkSubscribeRSS Feed
CraigKaercher
Calcite | Level 5

This will be embarrassingly easy to someone but I am trying to read in a text file.  I have done it in the past.  I have it in the same folder as the previous text files.  It will recognize the first one but not my new one.  I have tried to be extra careful concerning spelling, etc.  I do not understand why it can find one but not the other.

9 REPLIES 9
Cynthia_sas
SAS Super FREQ

Hi:

You will not be able to use your Windows path. But you should be able to simply use an INFILE statement or a FILE= option (depending on how you're reading the data):

INFILE "/folders/myfolders/Pgm1ExtInp.txt";

or

FILE="/folders/myfolders/Pgm1ExtInp.txt";

  I made up some fake data (just 2 rows) and wrote a little program to illustrate. All the program is doing is dumping the records into the SAS log.

cynthia

read_data_sas_ue.png

CraigKaercher
Calcite | Level 5

Cynthia,

Thanks but I don't think that will work.  The file that already existed works:

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

42 ;

43 data DetailINP;

44 infile "/folders/myfolders/fabscdataoct.txt" DLM='|' Firstobs=2;

45 INPUT ACCOUNT :$10. LEVEL1 $ LEVEL2 $ DISPLA $ CIRCUIT $

46 CALLS $ MINUTES $ COST $ DISCOUNT $

47 TAXES $ CIRCUITCST $ MRCCOST $ CREDITS $ FINALAMOUNT;

48 put ACCOUNT FINALAMOUNT;

49 RUN;

NOTE: The infile "/folders/myfolders/fabscdataoct.txt" is:

  Filename=/folders/myfolders/fabscdataoct.txt,

  Owner Name=sasdemo,Group Name=sas,

  Access Permission=-rw-rw-r--,

  Last Modified=13Oct2014:12:33:51,

  File Size (bytes)=116480

But it can't find the other file even though it is in the same directory:

54 

55 data AccountINP;

56 infile "/folders/myfolders/fabscaccountinfo.txt" dlm =' ' Firstobs=1;

57 INPUT ACCOUNT :$10. CompName $ CompAddress $ CompCity $

58 CompState $ CompZip $;

59 put ACCOUNT CompName;

60 RUN;

ERROR: Physical file does not exist, /folders/myfolders/fabscaccountinfo.txt.

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.ACCOUNTINP may be incomplete. When this step was

  stopped there were 0 observations and 6 variables.

WARNING: Data set WORK.ACCOUNTINP was not replaced because this step was

  stopped.

Tom
Super User Tom
Super User

Looks like either your Windows session is looking at a different folder or there is some strange character in the filename that is not captured in the screen shot.

Try making a new file from SAS and see if it appears in your Windows Explorer screen.

data _null_;

  set sashelp.class ;

  file '/folders/myfolders/brand_new_file.csv' dsd ;

  put (_all_) (:);

run;

CraigKaercher
Calcite | Level 5

That works like I believe you were expecting.  I see it in the file list in SAS, BUT...  I don't see it in Windows Explorer.  Windows Explorer should see it, right?  Thanks for the help.

Craig

Tom
Super User Tom
Super User

Looks like you are looking in the wrong folder in Windows.  Double check how you mapped the folders in your virtual machine.

Reeza
Super User

Couple of things, restart your VM.

You should see the file both in your folder list and your windows explorer.

If the file has weird characters or the input statement is incorrect I've seen SAS UE throw that error, even though the file exists - not helpful.

The file path is case sensitive since it's Unix

CraigKaercher
Calcite | Level 5

Sorry for the delay.  Still in the same situation.  How do I find where "/folders/myfolders/" maps to?  Thanks.

Craig

CraigKaercher
Calcite | Level 5

I looked but it doesn't seem to have the mapping to myfolders.  I checked and the one file fabscdataoct.txt only occurs in one directory on the drive where SAS University Edition is.  That is where the other one is.  It still just doesn't show up and the SAS dataset I created does not appear in Windows Explorer.

Craig

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 9 replies
  • 1129 views
  • 0 likes
  • 4 in conversation