BookmarkSubscribeRSS Feed
bob_pearson
Calcite | Level 5

This is my first attempt at data _null_ reports with ODS, and I'm just learning how things work.

 

I'm creating a report to show project information from a questionnaire. One item is project description with can be very long. I'm starting with a dataset with one client per row. I created a tall report dataset with three reporting columns. I'd like to end up with a separate page for each client. So I have a by-group data step. I am not sure what to use for the put statement in the last.client condition. _BLANKPAGE_ seems to not be right for ODS. It inserts a great many blank lines following the value. What is the right way to do this? 

 

Thanks

 

 

data report ;
   keep client var label text;

   set survey;
   by descending client notsorted;
   length var $10 label $25 text $3000;
   array vars client email campaddr q2_6: q3_2;
   where q9_1=1;  

   do i = 1 to dim(vars);
      var = vname(vars{i});
      label = vlabel(vars{i});
      text = vars{i};
      output;
   end;
run;

*proc print data=one;
run;

data _null_;
   set report;
   by client var notsorted;
   file print ods=(variables=(label text)) ;

   put _ods_;
   if last.client then put _BLANKPAGE_;
run;

 

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Errm, why not just get your data, then use ods <destination> and use proc report, then you can simply do page breaks and all the normal formatting methods.  Not sure what creating a plain text file from a datastep is going to get you, you certainly won't get most of the formatting.  If your exporting the data for transfer, then CSV or XML, for reports RTF or PDF.

bob_pearson
Calcite | Level 5

As an old co-worker used to say, you touched me right there.

 

That was one of those cases of getting stuck in plan A. My original attempt was to do it all in one data step. Then once I figured out that I should make a report dataset I was stuck in Data _Null_mode. Sorry for a silly one.

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