BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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:

Page 1:
ID #:
XXXXXX
Name:
XXXXX, XXX
City:
XXXXXXXX

Page 2:
ID #:
YYYYYYY
Name:
YYYYY, YYY
City:
YYYYY

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.

Thanks! I just realized that this is probably in the wrong forum. I'd welcome any help, but I'm going to repost it in the procedures forum.

Message was edited by: JS2008
1 REPLY 1
deleted_user
Not applicable
Alas, no quick way of doing this with a procedure occurs to me (which is not to say one doesn't exist).

You can roll your own with a data _null_ step;

data _null_;
set your_list_of_names;
page + 1;
put "Page:" page/
"ID #:"/
idnum/
"Name:"/
last "," first/
"City:"/
cityName;
put _page_;
run;

The "/" moves to a new line; the put _page_ forces a page eject. Elaborations based on the n=ps option of the file statement and the put #pagenum
put statement are possible.

Jonathan


> 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:
>
> Page 1:
> ID #:
> XXXXXX
> Name:
> XXXXX, XXX
> City:
> XXXXXXXX
>
> Page 2:
> ID #:
> YYYYYYY
> Name:
> YYYYY, YYY
> City:
> YYYYY
>
> 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.
>
> Thanks!
>
> I just realized that this is probably in the wrong
> forum. I'd welcome any help, but I'm going to repost
> it in the procedures forum.
>
> age was edited by: JS2008

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 552 views
  • 0 likes
  • 1 in conversation