BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
odrisco4
Fluorite | Level 6
I'm trying to run predefined code to calculate something but I get the errors below. I'm trying to read Totals.csv and run hei2015.score.macro.sas and write the result in  folder Res. All are in the Files (home) folder. Is there something I'm missing in the file path instead of it just being /home/my username/?
 
%let home = /home/my username/;
filename Totals “&home\Totals.csv”;
____
23
WARNING: Apparent symbolic reference HOME not resolved.
ERROR: Error in the FILENAME statement.
ERROR 23-2: Invalid option name home.
 
filename res “&home\Res”;
____
23
ERROR 23-2: Invalid option name home.
 
filename res “&home\Res”;
______
23
WARNING: Apparent symbolic reference HOME not resolved.
ERROR: Error in the FILENAME statement.
ERROR 23-2: Invalid option name Res”.
 
WARNING: Apparent symbolic reference HOME not resolved.
%include “&home\hei2015.score.macro.sas”;
ERROR: Incorrect %INCLUDE statement will not be executed. There is a syntax error.
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

 

View solution in original post

14 REPLIES 14
AhmedAl_Attar
Ammonite | Level 13

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 \;
odrisco4
Fluorite | Level 6
I changed them but I get the same errors.
Cynthia_sas
SAS Super FREQ
Hi, My suggestion is that you open the Server Files and Folders pane and find Totals.csv in the file list. Then, when you find the file, right click on the file name and in the popup window, choose Properties.
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
Reeza
Super User
You have curly quotes, probably copy and pasted from a word type document? Replace them with straight quotes and it should work fine.

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.
odrisco4
Fluorite | Level 6

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.

 

 %let home = /home/username;
filename Totals "&home/Totals.csv";
WARNING: Apparent symbolic reference HOME not resolved.
 
 filename res "&home/Res";
WARNING: Apparent symbolic reference HOME not resolved.
WARNING: Apparent symbolic reference HOME not resolved.
 
%include "&home/hei2015.score.macro.sas";
WARNING: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/&home/hei2015.score.macro.sas.
ERROR: Cannot open %INCLUDE file &home/hei2015.score.macro.sas.
ballardw
Super User

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.

Tom
Super User Tom
Super User

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.

 

odrisco4
Fluorite | Level 6

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;

 

Reeza
Super User
Please post your actual code and log for further assistance. The code is fairly basic so it should work as posted. There's something missing. Or as Tom indicated, retype the code. Copying and pasting may have introduced some invisible characters.
Tom
Super User Tom
Super User

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

odrisco4
Fluorite | Level 6

SAS.png

 

This is code, which I retyped in a new window and left out the rest of the program. 

odrisco4_1-1703178619445.png

 

This is the log.

odrisco4_5-1703178995364.png

 


 


 


 

 
Cynthia_sas
SAS Super FREQ

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

Cynthia_sas_0-1703177407704.png

  I can successfully import the CSV file, as shown below:

Cynthia_sas_1-1703177445868.png

 

However, note that when I don't use the correct case for the file name I get the "Physical file does not exist" message:

Cynthia_sas_2-1703177509829.png

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

odrisco4
Fluorite | Level 6

I was missing a /  and now it works. So I guess retyping the whole thing did it. Thank you everyone for the help.

Tom
Super User Tom
Super User

Remember if you don't start the path the root node then it is a RELATIVE path and not an ABSOLUTE path.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 14 replies
  • 4734 views
  • 3 likes
  • 6 in conversation