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

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
  • 1 reply
  • 765 views
  • 0 likes
  • 1 in conversation