BookmarkSubscribeRSS Feed
dcortell
Pyrite | Level 9

Hi all. I'm using the below very simple code in order to send an email from SAS EG with an attached file. However, I receive this error from the log:

 

195 p "Check this.";
_
180

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

 

Which I do not understand at all as the "p" is a key element in the proc odstext structure. Also, other proc odstext codes, which are running perfectly in other program, just within this one get the same error.

 

It seems really really weird that just within this code I'm getting this error. Any hint or suggestion about what could be the reason behind?

 

Bests (code syntax below)

 

-------------------------------------------------------------------------------------------------------------------------------------------------

 

proc sql;
drop table lead_forum ;
quit;

proc sql;
create table lead_forum as
select
ACCOUNT_NAME,

RION_CONTACT_ID,
full_name,
INTERACTION_STATUS,
STANDARDIZED_JOB_TITLE,

TSR_OWNER_NAME,

primary_email,
optin_indicator,
OPTIN_DATE

from rion_interaction a
left join rion_contact b on a.orion_contact_id=b.orion_contact_id
left join rion_account c on b.orion_account_id=c.orion_account_id
left join emailoptin d on b.primary_email=d.email

where interaction_id=3147030

order by rion_contact_id;
quit;


data counter (where=(count>1));
set lead_forum;
count+1;
by rion_contact_id;
if first.rion_contact_id then count=1;
run;


proc sql;
select count(rion_contact_id) into:N

from counter;
quit;


%macro check_phase1;

%if &N>0 %then %do;

%put %str(ER)ROR: Duplicates in orion_contacts .;

%end;

%mend;


%check_phase1;




proc export 
data=lead_forum
dbms=dlm
outfile="~/Lead_Forum_contact_BX.csv"
replace;
delimiter=";"
;
run;


proc template;

define style styles.purple;
parent=styles.sasweb;
class Header /
background=purple
foreground=white;
end;


%let today=%sysfunc(today(),date9.);
%put &today;

filename outbox email ""

TO=("" *)


FROM=("")

subject="Interactions Forum BX. Date : &today"

attach=("~/Lead_Forum_contact_BX.csv"
content_type="application/docx")

lrecl=256 
type="TEXT/HTML";

options nocenter;
ods MSOFFICE2k body=outbox style=minimal;
OPTIONS SPOOL; 
ods escapechar='^';

proc odstext;
p "Check this.";
run;

ods _all_ close;

filename outbox clear;

 

1 REPLY 1
ballardw
Super User

Your particular error is going to be related to something prior to the Proc ODStext.

 

Look closely at the log above that error for something that didn't finish as expected.

 

My suspicion is that the proc export or the filename outbox may have an issue, but that's guess.

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 1 reply
  • 862 views
  • 0 likes
  • 2 in conversation