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)?
The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at 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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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