BookmarkSubscribeRSS Feed
daffodil
Calcite | Level 5
Hello,

I am using ODS to write 3 datasets in to different worksheets in to a single excel sheet.

Each time , not all the datasets produces results.Say for Eg., Dataset 1 doesnt produce results .I want the worksheet of that dataset to be pulled as blank with header indicating that no results are being pulled up.If the dataset has some values being pulled up then it should show up the actual data.

Could anybody please help me out in deriving this out..

Thanks in advance !!! Message was edited by: daffodil
1 REPLY 1
data_null__
Jade | Level 19
If the data set exists but has ZERO obs then you can add one with all missing values. I think this should allow the EXCEL sheet to be created, but I have not tested that. Here is a program that will add one obs to a zero obs data set or do nothing if the data set has observations.

[pre]
data class;
stop; /* comment or remove stop to test with obs */
set sashelp.class;
run;

data class;
if _n_ eq 1 and eof then output;
stop;
modify class end=eof;
run;
proc print;
run;
[/pre]

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
  • 607 views
  • 0 likes
  • 2 in conversation