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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.