Hi there,
I need help to output file in pdf format with a Title that correspondence to the ID.
I have 2 tables:
table 1:
ID | VISIT | LAB |
10 | 1 | YES |
10 | 2 | NO |
10 | 3 | NO |
20 | 2 | YES |
20 | 3 | YES |
20 | 5 | NO |
20 | 6 | NO |
table 2:
ID | GENDER |
10 | FEMALE |
20 | MALE |
I want the pdf output as following (page 1, page2 etc..)
PAGE 1 look like this:
GENDER: FEMALE
ID |
VISIT |
LAB |
10 |
1 |
YES |
10 |
2 |
NO |
10 |
3 |
NO |
PAGE2:
GENDER: MALE
ID |
VISIT |
LAB |
20 |
2 |
YES |
20 |
3 |
YES |
20 |
5 |
NO |
20 |
6 |
NO |
How to code(link) the 2 tables into one output?
Thank you in advance, really appreciate your time.
Like this?
data TABLE1;
input ID VISIT LAB $3.;
cards;
10 1 YES
10 2 NO
10 3 NO
20 2 YES
20 3 YES
20 5 NO
20 6 NO
run;
data TABLE2;
input ID GENDER $6.;
cards;
10 FEMALE
20 MALE
run;
proc sql;
create table REPORT as select * from TABLE1, TABLE2 where TABLE1.ID=TABLE2.ID order by ID;
quit;
ods pdf file="&wdir\t.pdf" startpage=bygroup notoc;
proc print data=REPORT noobs; by GENDER; *title2 'GENDER:#byval1'; var ID VISIT LAB; run;
ods pdf close;
Like this?
data TABLE1;
input ID VISIT LAB $3.;
cards;
10 1 YES
10 2 NO
10 3 NO
20 2 YES
20 3 YES
20 5 NO
20 6 NO
run;
data TABLE2;
input ID GENDER $6.;
cards;
10 FEMALE
20 MALE
run;
proc sql;
create table REPORT as select * from TABLE1, TABLE2 where TABLE1.ID=TABLE2.ID order by ID;
quit;
ods pdf file="&wdir\t.pdf" startpage=bygroup notoc;
proc print data=REPORT noobs; by GENDER; *title2 'GENDER:#byval1'; var ID VISIT LAB; run;
ods pdf close;
Thank you so much for your help!
it's exactly of what I expected.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.