[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: SAS Forum: How to Export your SAS as pdf (ods newfile=bygroup);
From: Roger DeAngelis <rogerjdeangelis () GMAIL ! COM>
Date: 2017-06-26 20:57:59
Message-ID: 4174583969762614.WA.rogerjdeangelisgmail.com () listserv ! uga ! edu
[Download RAW message or body]
SAS Forum: How to Export your SAS as pdf (ods newfile=bygroup);
Creating mutiple pdf file with group names
see
https://goo.gl/fKttVq
https://communities.sas.com/t5/General-SAS-Programming/How-to-Export-your-SAS-as-pdf/m-p/370635
Cynthia_sas
https://communities.sas.com/t5/user/viewprofilepage/user-id/13549
WORKING CODE (Two solutions)
============
1. ods pdf file="d:\pdf\bygrp_age1.pdf" newfile=bygroup;
proc print data=class;
by age;
2. if _n_=0 then DOSUBL
select quote(put(max(age),3.)) into :ages separated by ","
do age=&ages;
rc=dosubl('
ods pdf file="d:\pdf\bygrp_age&age..pdf";
proc print data=class(where=(age=&age));
var age name sex height weight;
ods pdf close;
1. d:\pdf\bygrp_age1.pdf
d:\pdf\bygrp_age2.pdf
d:\pdf\bygrp_age3.pdf
2. d:\pdf\bygrp_age12.pdf
d:\pdf\bygrp_age13.pdf
d:\pdf\bygrp_age314df
PDF is not supported in current WPS Express edition.
ERROR: pdf is not a valid ODS statement or destination
HAVE
====
Obs NAME SEX AGE HEIGHT WEIGHT
1 James M 12 57.3 83.0
2 Jane F 12 59.8 84.5
3 John M 12 59.0 99.5
4 Louise F 12 56.3 77.0
5 Robert M 12 64.8 128.0 d:\pdf\bygrp_age1.pdf
6 Alice F 13 56.5 84.0
7 Barbara F 13 65.3 98.0
8 Jeffrey M 13 62.5 84.0 d:\pdf\bygrp_age2.pdf
9 Alfred M 14 69.0 112.5
10 Carol F 14 62.8 102.5
11 Henry M 14 63.5 102.5
12 Judy F 14 64.3 90.0 d:\pdf\bygrp_age3.pdf
WANT
d:\pdf\bygrp_age1.pdf
=====================
AGE=12
Obs AGE NAME SEX HEIGHT WEIGHT
1 12 James M 57.3 83.0
2 12 Jane F 59.8 84.5
3 12 John M 59.0 99.5
4 12 Louise F 56.3 77.0
5 12 Robert M 64.8 128.0
d:\pdf\bygrp_age2.pdf
=====================
AGE=13
Obs AGE NAME SEX HEIGHT WEIGHT
6 13 Alice F 56.5 84
7 13 Barbara F 65.3 98
8 13 Jeffrey M 62.5 84
d:\pdf\bygrp_age3.pdf
=====================
AGE=14
Obs AGE NAME SEX HEIGHT WEIGHT
9 14 Alfred M 69.0 112.5
10 14 Carol F 62.8 102.5
11 14 Henry M 63.5 102.5
12 14 Judy F 64.3 90.0
* _ _ _
_ __ ___ __ _| | _____ __| | __ _| |_ __ _
| '_ ` _ \ / _` | |/ / _ \ / _` |/ _` | __/ _` |
| | | | | | (_| | < __/ | (_| | (_| | || (_| |
|_| |_| |_|\__,_|_|\_\___| \__,_|\__,_|\__\__,_|
;
proc sort data=sashelp.class out=class;
by age;
where age in (12, 13, 14);
run;
* _ _ _ _
___ ___ | |_ _| |_(_) ___ _ __ / |
/ __|/ _ \| | | | | __| |/ _ \| '_ \ _____| |
\__ \ (_) | | |_| | |_| | (_) | | | |_____| |
|___/\___/|_|\__,_|\__|_|\___/|_| |_| |_|
;
* _ _ _
___ ___ | |_ _| |_(_) ___ _ __
/ __|/ _ \| | | | | __| |/ _ \| '_ \
\__ \ (_) | | |_| | |_| | (_) | | | |
|___/\___/|_|\__,_|\__|_|\___/|_| |_|
;
ods pdf file="d:\pdf\bygrp_age1.pdf" newfile=bygroup;
proc print data=class;
by age;
var age name sex height weight;
run;
ods pdf close;
* _ _ _ ____
___ ___ | |_ _| |_(_) ___ _ __ |___ \
/ __|/ _ \| | | | | __| |/ _ \| '_ \ _____ __) |
\__ \ (_) | | |_| | |_| | (_) | | | |_____/ __/
|___/\___/|_|\__,_|\__|_|\___/|_| |_| |_____|
;
%symdel age;
data _null_;
if _n_=0 then do;
%let rc=dosubl('
proc sql;
select
quote(put(max(age),3.))
into
:ages separated by ","
from
class
group
by age
;quit;
'));
end;
do age=&ages;
call symputx('age',age);
rc=dosubl('
ods pdf file="d:\pdf\bygrp_age&age..pdf";
proc print data=class(where=(age=&age));
var age name sex height weight;
run;
ods pdf close;
');
end;
run;quit;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic