BookmarkSubscribeRSS Feed
sunilreddy
Fluorite | Level 6

Hi I am getting popup message while using below code.

data _null_ ;

  file _webout ;

  val = '<script type="text/JavaScript">alert("MY MESSAGE HERE ")</script>';

  put val;

run;

but getting error while using macro variable in above alert.

%let Trigger_Button = ALL Buttons;

24        +

25        + data _null_ ;

26        +  file _webout ;

27        +  val = "<script type='text/JavaScript'>alert( "&Trigger_Button." )</script>";

28        +  put val;

29        + run;

30        +

31        +

32        +%mend;

33        +%mail1;

                                                                                          The SAS System

NOTE: Line generated by the macro variable "TRIGGER_BUTTON".

33          "<script type='text/JavaScript'>alert( "ALL Buttons

            ___________________________________________

            49                                      388

                                                    76

NOTE 49-169: The meaning of an identifier after a quoted string may change in a future SAS release.  Inserting white space between a quoted string and the succeeding identifier is recommended.

ERROR 388-185: Expecting an arithmetic operator.

ERROR 76-322: Syntax error, statement will be ignored.

Any one help me how to use macro variable along with comment in above

1 REPLY 1
Tom
Super User Tom
Super User

Your quoting is messed up.  If you want to have a dquote character inside of string that is quoted with that character then double it inside the string.

val = "<script type='text/JavaScript'>alert( ""&Trigger_Button."" )</script>";


Also why are you assigning the value to a variable instead of just using it in the put statement?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1256 views
  • 0 likes
  • 2 in conversation