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:
instcode | afflcode |
83 | 1 |
83 | 1 |
83 | 13 |
83 | 10 |
83 | 5 |
83 | 11 |
83 | 17 |
83 | 2 |
83 | 14 |
73 | 1 |
73 | 1 |
73 | 22 |
73 | 17 |
73 | 10 |
73 | 16 |
73 | 13 |
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,
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.
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;
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.
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.
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.