BookmarkSubscribeRSS Feed
Scooby3g
Obsidian | Level 7

Hi, I had transpose a table by count ( created count by doing Count =count+1) then created a table for each count. Is there a way to make these output as pdf as well?

Then for me to attach these as PDF to send in a macro sas script?

 

Each time i pull a List i have no way of knowing how many people will be on the list.

 

Thanks for any help and input! (still sorta new to SAS and learning)

 


data YES1 YES2 YES3 YES4 YES5 YES6 YES7 YES8 YES9 YES10
YES11 YES12 YES13 YES14 YES15 YES16 YES17 YES18 YES19 YES20
YES21 YES22 YES23 YES24 YES25 YES26 YES27 YES28 YES29 YES30
YES31 YES32 YES33 YES34 YES35 YES36 YES37 YES38 YES39 YES40 
YES41 YES42 YES43 YES44 YES45 YES46 YES47 YES48 YES49 YES50
YES51 YES52 YES53 YES54 YES55 YES56 YES57 YES58 YES59 YES60
YES61 YES62 YES63 YES64 YES65 YES66 YES67 YES68 YES69 YES70
YES71 YES72 YES73 YES74 YES75 YES76 YES77 YES78 YES79 YES80;
set Hello_list2;
if count=1 then output YES1;
if count=2 then output YES2;
if count=3 then output YES3;
if count=4 then output YES4;
if count=5 then output YES5;
if count=6 then output YES6;
if count=7 then output YES7;
if count=8 then output YES8;
if count=9 then output YES9;
if count=10 then output YES10;
if count=11 then output YES11;
if count=12 then output YES12;
if count=13 then output YES13;
if count=14 then output YES14;
if count=15 then output YES15;
if count=16 then output YES16;
if count=17 then output YES17;
if count=18 then output YES18;
if count=19 then output YES19;
if count=20 then output YES20;
if count=21 then output YES21;
if count=22 then output YES22;
if count=23 then output YES23;
if count=24 then output YES24;
if count=25 then output YES25;
if count=26 then output YES26;
if count=27 then output YES27;
if count=28 then output YES28;
if count=29 then output YES29;
if count=30 then output YES30;
if count=31 then output YES31;
if count=32 then output YES32;
if count=33 then output YES33;
if count=34 then output YES34;
if count=35 then output YES35;
if count=36 then output YES36;
if count=37 then output YES37;
if count=38 then output YES38;
if count=39 then output YES39;
if count=40 then output YES40;
if count=41 then output YES41;
if count=42 then output YES42;
if count=43 then output YES43;
if count=44 then output YES44;
if count=45 then output YES45;
if count=46 then output YES46;
if count=47 then output YES47;
if count=48 then output YES48;
if count=49 then output YES49;
if count=50 then output YES50;
if count=51 then output YES51;
if count=52 then output YES52;
if count=53 then output YES53;
if count=54 then output YES54;
if count=55 then output YES55;
if count=56 then output YES56;
if count=57 then output YES57;
if count=58 then output YES58;
if count=59 then output YES59;
if count=60 then output YES60;
if count=61 then output YES61;
if count=62 then output YES62;
if count=63 then output YES63;
if count=64 then output YES64;
if count=65 then output YES65;
if count=66 then output YES66;
if count=67 then output YES67;
if count=68 then output YES68;
if count=69 then output YES69;
if count=70 then output YES70;
if count=71 then output YES71;
if count=72 then output YES72;
if count=73 then output YES73;
if count=74 then output YES74;
if count=75 then output YES75;
if count=76 then output YES76;
if count=77 then output YES77;
if count=78 then output YES78;
if count=79 then output YES79;
if count=80 then output YES80;
run; 

proc sql;
select memname from dictionary.tables 
  where libname='WORK' and nobs=0;
quit;

proc sql;
select memname into :dellist separated by ' ' from dictionary.tables 
  where libname='WORK' and nobs=0;
quit;

proc datasets nolist;
delete &dellist;
quit; 

 

3 REPLIES 3
CarmineVerrell
SAS Employee

Can you please provide a sample data source and the result you are trying to obtain please.

 

Without these its very difficult to help you figure out a solution.

 

Thanks

 

 

ballardw
Super User

There are no PDF files generated with that code. So what should be in each of the PDFs?

 

The ODS PDF destination statement option NEWFILE will create sequentially numbered output files with the BYGROUP option

For example this code

proc sort data=sashelp.class
   out=work.class;
   by sex age;
run;

ods pdf file="class1.pdf" newfile=bygroup;

proc print data=work.class;
   by sex age;
run;

ods pdf close;

Will create  Class1.pdf, Class2.pdf through Class10.pdf.

Reeza
Super User
Is this HW?
It seems like you want to generate a set of reports and send them via email. Why the multiple data sets. I guarantee whatever you're doing there in that method is inefficient.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 839 views
  • 0 likes
  • 4 in conversation