I posted this question in the DATA step forum, but I think it might belong here.
I produce a weekly SAS data set for which I would like to print one record per page for the staff member who will be using it. I'd like it to look something like this:
I know I can use the Reports function in Microsoft Access or Mail Merge in MS Word, but is there a way to get SAS to do this? I tried using PROC PRINT with a BY statement. However, the staff member specifically asked for it not to be a line listing, and I haven't been able to get PROC PRINT to give me anything else.
I am working with electronic laboratory reports for infectious disease surveillance. I wrote a SAS program that goes through all the lab reports and keeps only the ones we need. When it is done, I have lists of tests to send to other databases. It looks something like this when I use PROC PRINT or export it to an Excel file:
ID# LName FName TestDate TestResult
12356 Doe John 06/31/2013 Positive
98895 Doe Jane 04/31/2013 Positive
Some of the tests must be entered by hand into their final destinations. The staff member who is responsible for this does not like the format above. I tried this:
proc sort data=updates;
ods pdf file='L:\elr\updates_20100329.pdf;
proc print data=updates noobs;
title 'ELR Updates';
ods pdf close;
This would work if I could figure out a way to control where each field went, like this:
I'll play around with it more and welcome any further suggestions. Thanks again!
I posted an answer to this in your other thread. You could use ODS to put the output into Excel, which strikes me as much easier to work with than pdf.
It would help if you would specify the exact format desired; in your other post you didn't. You could still use the approach there, using the "header" file statement option and n=ps;
It would help if you elaborated "other databases." Enter by hand?! Anathema.
> Thanks everyone for the help so far!
> I am working with electronic laboratory reports for
> infectious disease surveillance. I wrote a SAS
> program that goes through all the lab reports and
> keeps only the ones we need. When it is done, I have
> lists of tests to send to other databases. It looks
> something like this when I use PROC PRINT or export
> it to an Excel file:
> ID# LName FName TestDate
> Doe John 06/31/2013
> Doe Jane 04/31/2013
> of the tests must be entered by hand into their
> final destinations. The staff member who is
> responsible for this does not like the format above.
> I tried this:
> proc sort data=updates;
> by id;
> ods pdf file='L:\elr\updates_20100329.pdf;
> proc print data=updates noobs;
> by id;
> title 'ELR Updates';
> ods pdf close;
> This would work if I could figure out a way to
> control where each field went, like this:
> LName FName
> Doe John
> TestDate TestResult
> 06/31/2013 Positive
> I'll play around with it more and welcome any further
> suggestions. Thanks again!
If I understand your requirement correctly. Please use below logic. I took an example as per your posting.
Note: Last put statement may not be efficient logic but you can use this logic as per your requirements.
input id Name $ City $;
111 Name1 City1
222 Name2 City2
333 Name3 City3
444 Name4 City4
555 Name5 City5
666 Name6 City6
Filename pr "";
file pr N=1;
put id =;
put City= ;
let me know if you need any other inputs.
Oracle Corporation (Formerly: Sun Microsystems Inc.)