- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The first statement did not "take" so that is why the second statement is not find the macro variable it was supposed to define.
So fix the first statement. And make sure it worked.
%let home = /home/username;
%put &=home;
If you cannot see any problem then delete it and retype it. You might have some other invisible characters from copy and paste that you cannot see that are confusing SAS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @odrisco4
You'll need to fix your use of the folder separator and macro definition
%let home = /home/<my username>; * Remove trailing /;
filename Totals “&home/Totals.csv”; * Use / instead of \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The Location field of the Properties window will show you the EXACT and full path to use. I suggest you test your program by hard-coding the path without using macro variables first and make sure it works.
As an example of what could go wrong, if you have TOTALS.CSV in a sub-folder under /home, called my data, then the correct path would be something like:
/home/u12345678/mydata/totals.csv
You need to know, exactly, what the full path to totals.csv is before you can code a macro variable to supply part of the path in code. Also, as previously suggested, you need to use Unix slashes, not Windows slashes in your path name.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If not, go to file in the the Servers Folders and Files pane and find the file. Right click the folder/file, select properties and get the path from there and paste that into your code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I did paste this from a word doc so changing the quotes fixed a few of the errors, but there are still warnings. I still get the last error about running the macro though. I thought maybe a I needed to put /pbr/biconfig/940/Lev1/SASApp/ in front of the file name but that didn't change anything. The files are not in a sub folder, they're directly in /home/username and that's the only file path I get when I check properties.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
And names in paths are case sensitive. If the file actual name is "totals.csv" then "Totals.csv" is not the same.
Likely all of your path and the file name should be lower case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The first statement did not "take" so that is why the second statement is not find the macro variable it was supposed to define.
So fix the first statement. And make sure it worked.
%let home = /home/username;
%put &=home;
If you cannot see any problem then delete it and retype it. You might have some other invisible characters from copy and paste that you cannot see that are confusing SAS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I added the below and it eliminated one warning but the other warnings and the error are still there.
%let home = /home/username;
%put &=home;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
But the error messages should be DIFFERENT now. They should no longer say they cannot find a file with '&home' in its name.
Did you try to ask the SAS/Studio interface to show you the actual name of the file you want to read from as other's have asked?
Remember that Unix filenames are case sensitive. GEORGE.CSV is a different file than either george.csv or George.CSV or ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This is code, which I retyped in a new window and left out the rest of the program.
This is the log.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I don't know what your other errors are or what's in your macro program, but running a test on my SAS OnDemand account with a small CSV file under my /home folder
I can successfully import the CSV file, as shown below:
However, note that when I don't use the correct case for the file name I get the "Physical file does not exist" message:
So this shows that when the path is correct and the quotes are not curly quotes and the slashes are correct, it is possible to point to and read a CSV file that is directly under your /home folder.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I was missing a / and now it works. So I guess retyping the whole thing did it. Thank you everyone for the help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Remember if you don't start the path the root node then it is a RELATIVE path and not an ABSOLUTE path.