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-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!

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.

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