BookmarkSubscribeRSS Feed
cjac45
Fluorite | Level 6

I need help.  I am trying to create a PDF or RDF that looks like the following:

cjac45_0-1618941810096.png

I have tried a few things with no luck.  I am struggling because of the different data types.  Any help I would appreciate.  

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Provide the code you are using (paste it into a code box by clicking on the "running man" icon) and explain clearly what isn't working. Also provide the data set used by following these instructions.

--
Paige Miller
ballardw
Super User

Look at the data step Report Writing Interface starting here: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/odsadvug/part-3.htm

 

Complex results means more complex coding. Your example shows what appears to be "header" information followed by details. Depending on how your data is structured this is possible but not trivial.

Cynthia_sas
SAS Super FREQ

Hi:

  I think how you do this depends on the structure of the data and how you feel about coding. I can envision doing it either with PROC REPORT or with the Report Writing Interface. Using PROC REPORT would work for both ODS RTF and ODS PDF and ODS HTML. Using the Report Writing Interface would work with PDF and HTML.  But, without knowing more about what the data looks like and whether it needs to be restructured, it is hard to comment. For example, do you have the member information in one file and the allergy information in another file? In that case, you may need to restructure and manipulate the data before you can do your report. You may need macro processing if you need to produce this report for more than one person at a time. There are a lot of unanswered questions. Here's an example using SASHELP.CLASSFIT.

Cynthia_sas_0-1618947724219.png

 

Note that it takes 2 PROC REPORT steps to do this report for 1 person -- the name and other info at the top is one step using "restructured" data and the table with the statistics is a second step using the original dataset.

 

Cynthia

 

Here's the code I used:

 ** restructure data for top half of page;
data classfit;
  length ordname $20 col1 val1 col2 val2 $15;
  set sashelp.classfit(keep=name sex age height weight);
  ordname = catx('~',put(_n_,z2.),name);
  roword=1;
  col1 = 'Name';
  val1 = name;
  col2 = 'Gender';
  val2 = sex;
  output;
  roword=2;
  col1 = 'Age';
  val1 = put(age,2.0);
  col2 = ' ';
  val2 = ' ';
  output;
  roword=3;
  col1 = 'Height';
  val1 = put(height,6.2);
  col2 = 'Weight';
  val2 = put(weight,6.2);
  output;
run;

/* Name Sex Age Height Weight predict lowermean uppermean lower upper  */

ods pdf file='c:\temp\multsec.pdf' startpage=no;
ods rtf file='c:\temp\multsec.rtf' startpage=no; 

proc report data=classfit noheader style(report)={width=7in};
  title1 'Twas Brillig and the Slithy toves';
  title2 'Did Gyre and gimble in the wabe';
  title3 'All Mimsy were the borogroves';
  title4 'And the momeraths outgrabe.';
  where name = 'Joyce';
  column ordname roword col1 val1 blnk col2 val2;
  define ordname / order order=data noprint;
  define roword / order noprint;
  define col1 / style(column)=Header{background=white color=black font_style=bold};
  define val1 / style(column)=Data;
  define blnk / computed style(column)={bordertopcolor=white borderbottomcolor=white bordertopwidth=0px borderbottomwidth=0px};
  define col2 / style(column)=Header{background=white color=black font_style=bold};
  define val2 / style(column)= Data;
  compute blnk / character length=15;
     blnk = ' ';
  endcomp;
run;

title; footnote;
proc report data=sashelp.classfit  style(report)={width=7in}
     style(header)={background=aliceblue};
where name = 'Joyce';
  column Name predict lowermean uppermean lower upper;
run;
ods pdf close;
ods rtf close;
 
cjac45
Fluorite | Level 6

Hi Cynthia!  Completely understand what you are saying.  The data can be done either way.  Right now I have all the top portion (the vertical data) in one file and then the allergy in another.  Technically it could be done in one.  Right nowt he report would always only be ran for one member.  I didn't see your example, did I miss it?  I started out like this with my col1 and col2 as the first little table and then my col3 and col4 being the second table and all that information was in one dataset.  Then the allergy data I would have in another table.  I think by trying to put it in in the col1 and col2 and col3 and col4 if it isn't all character it is showing up blank?  I played around with the formatting but can't seem to get it to read the two different formats. I was trying to do it as simple as I could, but maybe that isn't possible 🙂  I appreciate you helping!

 


DATA have_orig
have_report(keep=ord sig col1 col2 );

set heading1;
output have_orig;

ord=1;
col1 = 'Member: ';
col2 = mem_name;
output have_report;

ord=2;
col1 = 'Member ID: ';
col2 = member_id;
output have_report;

ord=3;
col1='Phone #: ';
col2 = phone_nbr;
output have_report;

ord=4;
col1='Gender: ';
col2=gender;
output have_report;

ord=5;
col1='Date of Birth: ';
col2=mbr_dob;
/*length col1 $39. col2 $100.;*/
output have_report;

ord=6;
col1='State/Province/Region: ';
col2=mbr_state;
output have_report;

ord=7;
col1='Region Type: ';
col2=mbr_region_desc;
output have_report;

ord=8;
col1='Case Manager: ';
col2=staff_assigned;
output have_report;

ord=9;
col1='Effective Date: ';
col2=mi_effective_dts;
output have_report;

ord=10;
col1='PCP: ';
col2=p_organization_nm;
output have_report;
;
run;

 

DATA have_orig2()
have_report2(keep=ord sig col3 col4 );

set heading1;
output have_orig2;

ord=1;
col3 = 'PCP ID: ';
col4 = prv_name;
length col3 $39. col4 $100.;
output have_report2;

ord=2;
col3 = ' ';
col4 = '';
output have_report2;

ord=3;
col3='LOB: ';
col4 = mi_line_of_business_typ_desc;
output have_report2;

ord=4;
col3='COB: ';
col4=cob;
output have_report2;

ord=5;
col3='Group: ';
col4=ig_insurance_group_nm;
output have_report2;

ord=6;
col3='Plan: ';
col4=mi_plan_benefit_package_nm;
output have_report2;

ord=7;
col3='Medicare ID: ';
col4='';
output have_report2;

ord=8;
col3='Medicaid ID: ';
col4='';
output have_report2;

ord=9;
col3='Case Number: ';
col4=mpr_case_nbr;
output have_report2;

;
run;

Cynthia_sas
SAS Super FREQ
Hi:
I went back and edited the example. Sorry for not catching that.
Cynthia

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 646 views
  • 0 likes
  • 4 in conversation