Help using Base SAS procedures

Is There Anything Special To Have A File Recognized By SAS University Edition

Reply
Occasional Contributor
Posts: 13

Is There Anything Special To Have A File Recognized By SAS University Edition

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.

SAS Super FREQ
Posts: 8,683

Re: Is There Anything Special To Have A File Recognized By SAS University Edition

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

Occasional Contributor
Posts: 13

Re: Is There Anything Special To Have A File Recognized By SAS University Edition

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.

Super User
Super User
Posts: 6,144

Re: Is There Anything Special To Have A File Recognized By SAS University Edition

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_) (Smiley Happy;

run;

Occasional Contributor
Posts: 13

Re: Is There Anything Special To Have A File Recognized By SAS University Edition

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

Super User
Super User
Posts: 6,144

Re: Is There Anything Special To Have A File Recognized By SAS University Edition

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

Grand Advisor
Posts: 16,905

Re: Is There Anything Special To Have A File Recognized By SAS University Edition

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

Occasional Contributor
Posts: 13

Re: Is There Anything Special To Have A File Recognized By SAS University Edition

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

Craig

Grand Advisor
Posts: 16,905

Re: Is There Anything Special To Have A File Recognized By SAS University Edition

Check your VM settings

Occasional Contributor
Posts: 13

Re: Is There Anything Special To Have A File Recognized By SAS University Edition

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

Ask a Question
Discussion stats
  • 9 replies
  • 327 views
  • 0 likes
  • 4 in conversation