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.
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
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.
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;
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
Looks like you are looking in the wrong folder in Windows. Double check how you mapped the folders in your virtual machine.
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
Sorry for the delay. Still in the same situation. How do I find where "/folders/myfolders/" maps to? Thanks.
Craig
Check your VM settings
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.