Learning SAS? Welcome to the exclusive online community for all SAS learners.

Trying to refer to a macro from SAS U

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Trying to refer to a macro from SAS U

Hi Everyone,

I'm stuck and am seeking some help. So I set up the shared folder on VM and can see the .txt file I want to refer to. The original filename is intracc.sas and when using the following code,

%inc"/folders/myfolders/intracc.sas'";

%intracc(depvar=rating,target=patient,rater=nurse,nrater=0);

%intracc(data=ratings,depvar=rating,target=patient,rater=nurse, print=3,out=intclcor);

I get the following error:

101 %inc"/folders/myfolders/intracc.sas";

WARNING: Physical file does not exist, /folders/myfolders/intracc.sas.

ERROR: Cannot open %INCLUDE file /folders/myfolders/intracc.sas.

102 %intracc(depvar=rating,target=p1,rater=n1,nrater=0);

  _

  180

WARNING: Apparent invocation of macro INTRACC not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro INTRACC not resolved.

103 %intracc(data=ratings,depvar=rating,target=p1,rater=n1, print=3,out=intclcor);

  _

  180

ERROR 180-322: Statement is not valid or it is used out of proper order.

104 

105 

106 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

118 

Any assistance would be greatly appreciated! Thanks


Accepted Solutions
Solution
‎08-28-2015 10:09 AM
Super User
Super User
Posts: 7,942

Re: Trying to refer to a macro from SAS U

Well, there is your problem.  You have named the file intracc.sas.txt

                                                                                              ^

But you try to include a file called intracc.sas

                                                            ^

Notice the difference?

Always call your sas programs with the extension.sas, so rename the file at your OS level.

View solution in original post


All Replies
SAS Employee
Posts: 56

Re: Trying to refer to a macro from SAS U

Hi Neo22,

It looks like your first line of code might include both a single quote and double quotes at the end of the line -

%inc"/folders/myfolders/intracc.sas'";

If that's the case, try running it with just double quotes:

%inc"/folders/myfolders/intracc.sas"; 

I was able to successfully bring a SAS program from my myfolders folder into my SAS University Edition program using that line of code.

thanks,

Jennifer

New Contributor
Posts: 4

Re: Trying to refer to a macro from SAS U

Hi Jennifer,

Thank you for your response!

Unfortunately, I incur the same error with appropriate quotations.

101 %inc"/folders/myfolders/intracc.sas";

WARNING: Physical file does not exist, /folders/myfolders/intracc.sas.

ERROR: Cannot open %INCLUDE file /folders/myfolders/intracc.sas.

102 %intracc(depvar=rating,target=p1,rater=n1,nrater=0);

  _

  180

WARNING: Apparent invocation of macro INTRACC not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro INTRACC not resolved.

103 %intracc(data=ratings,depvar=rating,target=p1,rater=n1, print=3,out=intclcor);

  _

  180

ERROR 180-322: Statement is not valid or it is used out of proper order.

104 

105 

106 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

118 

SAS Employee
Posts: 56

Re: Trying to refer to a macro from SAS U

Hi Neo22,

Are you able to see the program in the Server Files and Folders section of the navigation pane like I can see hat.sas below:

hatprogram2.gif

thanks,

Jennifer

Super User
Super User
Posts: 7,942

Re: Trying to refer to a macro from SAS U

Can I clarify your post " So I set up the shared folder on VM and can see the .txt file I want to refer to." what txt file are you refering to?  The file should have the file extension .sas, and belocated in the path referenced: %inc"/folders/myfolders/intracc.sas'";

Is there a .sas file called intracc.sas in that folder?

New Contributor
Posts: 4

Re: Trying to refer to a macro from SAS U

Jennifer - It does show up and I've included a screenshot

RW9- It's a .txt file that contains coding for a SAS procedure. The name of the file is "intracc.sas"

Thanks to you both!

Solution
‎08-28-2015 10:09 AM
Super User
Super User
Posts: 7,942

Re: Trying to refer to a macro from SAS U

Well, there is your problem.  You have named the file intracc.sas.txt

                                                                                              ^

But you try to include a file called intracc.sas

                                                            ^

Notice the difference?

Always call your sas programs with the extension.sas, so rename the file at your OS level.

SAS Employee
Posts: 56

Re: Trying to refer to a macro from SAS U

Hi Neo22,

I think the problem might be that the file is actually named intracc.sas.txt rather than just intracc.sas.  Try renaming the file and running the code again.

thanks,

Jennifer

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 746 views
  • 6 likes
  • 3 in conversation