BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mauri0623
Quartz | Level 8

ods excel file="/home/sasuser/bin/MCDdata.xlsx"
options(sheet_name="MCD Data"
sheet_interval='none'
embedded_titles='yes');

title "Report for Johns Hopkins Medical Services Corporation";
proc print data = t_mcd noobs;
run;
ods excel close;

 

I want some kind of condition to decide to crate a .xlsx output or not create one. Please help

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

And the condition is provided by what? A parameter of the macro? If so, then just do something like:

 

%if &condition. = YES %then %do;
  insert your exporting code here
%end;

View solution in original post

3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Hi:
Unless you're doing some kind of macro program processing, you'd have to do this type of decision or conditional processing before you get to this point. If you mean you want to test t_mcd to see whether it has observations or is empty, then there are previous Forum postings on how to do this.

Cynthia
mauri0623
Quartz | Level 8

The code is in a macro already. I just want to say create a excel or don't. Condition "YES" or "NO".

andreas_lds
Jade | Level 19

And the condition is provided by what? A parameter of the macro? If so, then just do something like:

 

%if &condition. = YES %then %do;
  insert your exporting code here
%end;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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