&var | ||||||
Current Residence Status | total_bad |
| count | bad | Applicants (per cent) | Index |
Boarding | 11 |
| 34 | 0.3235294 | 12% | -36 |
Buyer | 1 |
| 17 | 0.0588235 | 6% | 391 |
Living w | 0 |
| 4 | 0 | 1% | . |
Other | 1 |
| 5 | 0.2 | 2% | 22 |
Owner | 10 |
| 70 | 0.1428571 | 25% | 84 |
Renting | 42 |
| 150 | 0.28 | 53% | -22 |
Supplied | 1 |
| 1 | 1 | 0% | -100 |
| 66 |
| 281 | 2.0052101 | 100% | 339 |
Hi, the above is what I get when I perform the proc report:
TITLE 'Table 4.1:Characteristic Analysis:&var';
ods rtf file="reportstyles.html" style=Journal;
proc report data=vha_acr.graph_curr_resistatus nowd
style(header) = [font=(Arial,3) just=center]
style(report) = [font=(Arial,2) borderwidth=1 CELLSPACING=5 just=center WIDTH=1000]
style(column) = [font=(Arial,2)just=center];
define Good / computed;
column ('&var' curr_resistatus total_bad Good count bad participants Index);
rbreak after / summarize UL OL;
run;
ods rtf close;
I want to define a new numeric variable called good defined by good=count-total_bad;
How would you do this? When I try to do it, I keep getting 0 for all entries and SAS says
total_bad is uninitialised.
I am also trying to put a label called "total" in the last row of the column Current Residence Status.
Many thanks
Hi:
There are many previous forum postings on the use of PROC REPORT. To get TOTAL on the last summary line of your report, you will need a COMPUTE AFTER section. You will also need to look up "left-to-right" processing with PROC REPORT (also in previous postings), and you will need to look up how to use a COMPOUND name. For example, if for some silly reason, I wanted to subtract AGE from HEIGHT for SASHELP.CLASS, and I did NOT have any DEFINE statements for either AGE or HEIGHT, the default usage of those variables would be ANALYSIS with the SUM statistic. The COLUMN statement and COMPUTE block using the compound name for calculating the difference would be:
column name sex height age diff;
compute diff;
diff = height.sum - age.sum;
endcomp;
In the COLUMN statement, DIFF would have to appear after HEIGHT and AGE in the COLUMN order and then the compound name:var.statistic would need to be used.
cynthia
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.