BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
rahulsaha2127
Fluorite | Level 6

I have a SAS code which will refer to a formula stored in external text file.

 

input data:

xy
1067
1570
3071

 

output data:

xyz
106777
157085
3071101

 

Written SAS Code:

 

data want;

set have;

%include "path/file_ln_model.txt"; 

run;

 

 

Text file (file_ln_model.txt):

z= x+y;

 

This above sas code throws the following error:

27 +z=x+y;
_____________
180

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

 

Please help to find the error in this code and provide any alternative situations.

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
s_lassen
Meteorite | Level 14

To me it looks like your file does not contain "z= x+y;", but "+z= x+y;". You can check what you %INCLUDE by using the SOURCE2 option:

data want;
  set have;
  %include "path/file_ln_model.txt" /source2; 
run;

View solution in original post

2 REPLIES 2
s_lassen
Meteorite | Level 14

To me it looks like your file does not contain "z= x+y;", but "+z= x+y;". You can check what you %INCLUDE by using the SOURCE2 option:

data want;
  set have;
  %include "path/file_ln_model.txt" /source2; 
run;
PeterClemmensen
Tourmaline | Level 20

There seems to be a preceding plus sign in your .txt file. Your code looks fine.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1189 views
  • 1 like
  • 3 in conversation