BookmarkSubscribeRSS Feed
jtcowder
Fluorite | Level 6

Questions of this sort have been asked and answered many times, but I am not seeing the exact solution I need.

 

I have codes for institutions, and sites that are affiliated with those institutions.  A subset of the data follows:

instcodeafflcode
831
831
8313
8310
835
8311
8317
832
8314
731
731
7322
7317
7310
7316
7313

 

I want a report that lists the instcode, and the afflcode (among other things).

 

My code is :

 

proc report data=dset spanrows;
columns instcode afflcode;

define instcode/ 'inst' order=data group;
define afflcode/ 'affiliate' order=data;

compute after instcode;
line ' ';
endcomp;
run;

 

The output looks fine,

 

reportoutput.JPG

 

 

but I get the warning

"NOTE: Groups are not created because the usage of afflcode is DISPLAY. To avoid this note,
change all GROUP variables to ORDER variables."

 

If I change instcode to order, I get

"ERROR: You can only BREAK on GROUPing and ORDERing variables."

 

and the output definitely does not look right.

 

I don't want to ignore the error as I feel I am doing that at potential peril.

 

Any help anyone has would be greatly appreciated.

2 REPLIES 2
DJongman
Obsidian | Level 7

Hi jtcowder,

 

Try:

 

data work.dset;
  input instcode $4. afflcode $2.  ;
  cards;
083	01
083	01
083	13
083	10
083	05
083	11
083	17
083	02
083	14
073	01
073	01
073	22
073	17
073	10
073	16
073	13
;
run;

proc sort data = work.dset out = work.dset_new;
by instcode afflcode;


proc report data=work.dset_new ;
	columns instcode afflcode;

	define instcode/ 'inst'  order order=internal;
	define afflcode/ 'affiliate';
run;

 

 

 

jtcowder
Fluorite | Level 6

Thank you.

 

The "order" statement was what I was missing.

Once I put the "order order=data" in the message went away.

 

Thank you for your help.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 5336 views
  • 0 likes
  • 2 in conversation