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

Hi Everyone,

I need one help related to macro variables which have null or no values which is resolving to " ".

I want to remove or supress " " this in output in SAS Email.

 

put "&segment1_Desc.<br />"; /*have no values*/
put "&segment1_link.<br />"; /*have no values*/

but in output getting " " " ". any ideas how to supress this " ".

 

Regards,

Manohar

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ManoharNath
Obsidian | Level 7

Sorry for delay in response and thank you everyone for your revert.

I was able to solve the prolem by using %if and %len method. 

 

This resolved the problem.

%if %length(Video_segment1) > 0 %then %do;

%put &Video_segment1.;

%put &Video_Desc.;

end;

View solution in original post

6 REPLIES 6
Kurt_Bremser
Super User

Please post the complete code, from the definition of the macro variables to the final RUN or ODS statement of the mail.

Post your code into a code box opened with the "little running man" button, right next to the one indicated here:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

The indicated button is for logs and other textual data where a non-porportional font and preserving horizontal positions and special characters is important.

ManoharNath
Obsidian | Level 7

How to remove missing values from email.

for below example: 

 

  put "<br />";
    put "&segment1_Desc.<br />";  /*no values and coming as " " in log and output */ 
    put "&segment1_link.<br />";    /*no values and coming as " " in log and output */
    put "&segment2_Desc.<br />"; /*no values and coming as " " in log and output */
    put "&segment2_link.<br />";    /*no values and coming as " " in log and output  */
    put "&segment3_Desc.<br />";  /*no values and coming as " " in log and output */
    put "&segment3_link.<br />";    /*no values and coming as " " in log and output */
    put "&segment4_Desc.<br />";  
    put "&segment4_link.<br />";  
    put "&segment5_Desc.<br />";
    put "&segment5_link.<br />";
    put "&segment6_Desc.<br />";  /*no values and coming as " " in log and output */
    put "&segment6_link.<br />";    /*no values and coming as " " in log and output */
    put "<br />";

 

for this I am getting " " in sas log and in sas test outlook email 

below is log:

SYMBOLGEN:  Macro variable SEGMENT2_DESC resolves to
MPRINT(EMAILHV):   put " ";

 

in output it coming as 

" " " " " " Video desc

video link

" "

 

I am trying to supress this " " to coming in mail.

 

Regards,

Manohar

Quentin
Super User
You'll need to add some conditional processing (probably via %IF). Is it the case that either all macro vars will be null or all will have a value? Or will you need to test each one individually? Do you have a way to know when the macro vars will be null (other than checking them)?
BASUG is hosting free webinars Next up: Mark Keintz presenting History Carried Forward, Future Carried Back: Mixing Time Series of Differing Frequencies on May 8. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
ManoharNath
Obsidian | Level 7

Sorry for delay in response and thank you everyone for your revert.

I was able to solve the prolem by using %if and %len method. 

 

This resolved the problem.

%if %length(Video_segment1) > 0 %then %do;

%put &Video_segment1.;

%put &Video_Desc.;

end;

ManoharNath
Obsidian | Level 7
Thank you for your revert.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 587 views
  • 0 likes
  • 3 in conversation