Hello
What is the way that the value under "Type" variable will be in each row of the report ?
I want to see in each row the value of "Type" var
proc tabulate data=sashelp.cars;
class type Cylinders;
var Invoice;
Table type=""*Cylinders='',Invoice*(N SUM) /box='Type/Cylinders';
Run;
Try this
proc tabulate data=sashelp.cars;
class type Cylinders;
var Invoice;
Table Cylinders=''*type="",Invoice*(N SUM) /box='Type/Cylinders';
Run;
Proc REPORT can present the data the same way as in TABULATE, with the extra caveat of filling in the 'blank' cells.
By default a group cell is blank in subsequent row after it is presented the first time. COMPUTE blocks can be used to track and replace the blank (missing) values with the current group value.
Example:
proc report data=sashelp.cars; columns type cylinders invoice,(n sum); define type / group; define cylinders / group; define n / format=8.; compute before type; type_held = type; endcomp; compute type; if missing(type) then type=type_held; endcomp; run;
REPORT output:
Versus TABULATE output:
You can get the same aggregation output from Proc MEANS
proc means data=sashelp.cars noNOBS N SUM ; class type cylinders; var invoice; run;
The default output does not repeat the type values.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.