Hi,
my output is displaying 'System Organ Class' for every row when I only want to display it for the first row per SOC.
It works (display only once) when I don't use variable 'seq'. However, when that is added, it stop working.
current:
want:
data:
MHSOC | MHPT | SEQ | |
Total | 1 | ||
Blood and lymphatic system disorders | Total | 2 | |
Blood and lymphatic system disorders | Anaemia | 3 | |
Cardiac disorders | Total | 4 | |
Cardiac disorders | Angina pectoris | 5 | |
Cardiac disorders | Atrial fibrillation | 6 | |
Cardiac disorders | Atrial flutter | 7 | |
Cardiac disorders | Cardiac failure | 8 | |
Cardiac disorders | Myocardial infarction | 9 | |
Cardiac disorders | Myocardial ischaemia | 10 | |
Congenital, familial and genetic disorders | Total | 11 | |
Congenital, familial and genetic disorders | Gilbert's syndrome | 12 | |
Congenital, familial and genetic disorders | Hereditary non-polyposis colorectal cancer syndrome | 13 | |
Endocrine disorders | Total | 14 | |
Endocrine disorders | Goitre | 15 | |
Endocrine disorders | Hyperparathyroidism | 16 | |
Endocrine disorders | Hyperthyroidism | 17 | |
Endocrine disorders | Hypothyroidism | 18 | |
Endocrine disorders | Testicular failure | 19 | |
Endocrine disorders | Thyroid disorder | 20 | |
Endocrine disorders | Thyroid mass | 21 | |
Eye disorders | Total | 22 | |
Eye disorders | Cataract | 23 | |
Eye disorders | Diabetic retinopathy | 24 | |
Eye disorders | Pterygium | 25 | |
Eye disorders | Retinopathy hypertensive | 26 |
ods rtf file="&analydir.\Output\t_3_mh.rtf" style=rtf_box ;*rtf_fda ;
ods escapechar='^';
proc report nowd headline headskip split='|' data=allmh2 spacing=2 missing spanrows
style(report)=[rules=groups frame=hsides];
cols seq mhsoc mhpt Thoracic Urologic ENT total;
define seq /order noprint;
define mhsoc / order 'System Organ Class' left style(column)={cellwidth=2.5in} style(header)=[just=left];
define mhpt / order 'Preferred Term' left style(column)={cellwidth=2.5in} style(header)=[just=left];
define Thoracic / display "_Thoracic_|(n=ð)" center style(column)={cellwidth=1.2in};
define Urologic / display "_Urologic_|(n=&comp)" center style(column)={cellwidth=1.2in};
define ENT / display "_ENT_|(n=&compd)" center style(column)={cellwidth=1.2in};
define total / display "_Total_| (n=&stot)" center style(column)={cellwidth=1.2in};
compute after mhsoc/style={fontsize=2pt just=left};
line " ";
endcomp;
compute after _page_;
line @1 " ";
endcomp;
run;
You cannot have an ORDER variable before the GROUP variable.
Try not using SEQ in the report.
Instead make sure the data is sorted by SEQ and use ORDER=DATA option on the System Organ Class.
define mhsoc / group order=data ....
Try defining SEQ and MHSOC as GROUP columns rather than ORDER ones.
You cannot have an ORDER variable before the GROUP variable.
Try not using SEQ in the report.
Instead make sure the data is sorted by SEQ and use ORDER=DATA option on the System Organ Class.
define mhsoc / group order=data ....
Hi:
It might also work to put SEQ after MHSOC in the COLUMN statement:
column mhsoc seq mhpt Thoracic Urologic ENT total;
You can still NOPRINT on SEQ and it should force the order you want within each value of MHSOC.
Cynthia
Yes, just realised that SEQ can't group because the value changes for each row. Try @Tom 's solution and don't use SEQ.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.