BookmarkSubscribeRSS Feed
JillChen0131
Fluorite | Level 6

I have dataset as below: I need to add a page variable to break dataset into different pages for proc report. In the final report, each group in their own page, each page can only show 5 records, so one group may have one or more pages. 

 

 

group     subgroup    count

    1                A             8

    1                B            6

    1                C            4

    1                D            3

    2                 E          10

    2                 A             9

    2                B            8

    2                D            7

   2                 F             6

   2                 G             5

  ...                 ...             ...

1 REPLY 1
AMSAS
SAS Super FREQ

Is this what you are looking for?
See REPORT Procedure 

 

data have ;
	do group=1 to 5 ;
		do subGroup=1 to int(ranuni(0)*3+1) ; 
			count=int(ranuni(0)*10) ;
			output ;
		end ;
	end ;
run ;

proc report data=have ;
	define group / order  ;
	define subGroup / display ;
	define count / display  ;
	break after Group / page ;
   

run;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 782 views
  • 0 likes
  • 2 in conversation