Hello,
I have the data and need to do this exact table
Table 1.0
(Demo Graphics & Base Line Characteristics)
|
Active (N= XX) |
Placebo (N= XX) |
Overall (N= XX) |
Age (years) |
|
|
|
N |
XX |
XX |
XX |
Mean |
XX.X |
XX.X |
XX.X |
Standard Deviation |
XX.XX |
XX.XX |
XX.XX |
Minimum |
XX.X |
XX.X |
XX.X |
Maximum |
XX.X |
XX.X |
XX.X |
Gender |
|
|
|
Male |
XX(XX.X%) |
XX(XX.X%) |
XX(XX.X%) |
Female |
XX(XX.X%) |
XX(XX.X%) |
XX(XX.X%) |
Race |
|
|
|
White |
XX(XX.X%) |
XX(XX.X%) |
XX(XX.X%) |
Black |
XX(XX.X%) |
XX(XX.X%) |
XX(XX.X%) |
Other* |
XX(XX.X%) |
XX(XX.X%) |
XX(XX.X%) |
* Other includes Asian, Native American, and other races.
*To create frequencies, percentages use proc freq
* To create n, mean, median, min, max, standard deviation use proc univariate.
I'm not sure if this is the correct way of doing it but I keep getting errors. I am so lost at this. all help is appreciated. Thank you in advance.
data DEMOG;
set TMP1.DEMOG;
if trt=0 then
do;
output;
trt=2;
output;
end;
if trt=1 then
do;
output;
trt=2;
output;
end;
run;
/*stats for age group*/
proc univariate data=demog noprint;
CLASS TRT;
var age;
Output out=AGEDS n=_n mean=_mean std=_std min=_min max=_max;
run;
proc sort ;
by trt;
run;
proc transpose data=AGEDS out=tranage;
by trt;
VAR _n _mean _std _max _min;
run;
data tranage;
set tranage;
INDEX=1;
col=trim(left(col1));
run;
/*stats for gender*/
proc freq data=demog;
tables gender*TrT/ out=adslgenfrq Norow nocol missing;
/*stats for gender*/
tables race*TRT/ out=adslracefrq Norow nocol missing;
/*stats for race*/
run;
data genfrq;
set adslgenfrq;
where gender ne .;
cntper=count || "("||trim(left(percent))||"%)";
if gender=1 then
_name_='M';
else
_name_='F';
INDEX=2;
rename cntper=col;
drop count percent gender;
run;
/*STATS FOR RACE*/
data racefrq;
set adslracefrq;
cntper=count || "("||trim(left(percent))||"%)";
if race=1 then
_name_='White';
else if race=2 then
_name_='Black';
else
_name_='Other';
INDEX=3;
drop count percent race;
rename cntper=col;
run;
data all;
set tranage genfrq racefrq;
run;
proc sort ;
by _name_;
run;
proc transpose data=all out=tranall;
var col;
BY _NAME_;
ID TRT;
RUN;
** Titles and Footnotes;
%titlfoot(title1, , Table 1);
%titlfoot(title2, , DEMOGRAPHICS & BASE LINE CHARACTERISTICS);
%titlfoot(footnote1);
%titlfoot(footnote2, *Other includes Asian, Native American, and other Races.));
%titlfoot(footnote3, *To create frequencies, percentages use proc freq);
%titlfoot(footnote4, *To create n, mean, medium, min, max, standard deviation
use proc univariate);
** Generate Report;
proc printto print="c:\Base.txt" new;
run;
proc report data=tranall nowindows headline split='|';
columns sectno statcode statname v0 v1 v2);
define sectno /group noprint;
define statcode /group noprint;
define statname /group ' ';
define v0 /display 'Active' width=10;
define v1 /display 'Placebo' width=10;
define v2 /display 'Overall' width=10;
compute before sectno;
line ' ';
line @8 sectno sectno.;
endcomp;
quit;
run;
proc printto ;
run;
@SasStudent2 wrote:
I'm not sure if this is the correct way of doing it but I keep getting errors. I am so lost at this. all help is appreciated. Thank you in advance.
What errors? We can't help with what we don't know. Copy the code from the log with data or proc step and any messages and paste them into a code box opened using the forum's {I} menu icon. The code box will preserve the formatting of the errors better than the main message windows here.
And provide some example data in the form of a data step.
Another example is the paper that John King and I worked on this year:
Manipulating Statistical and Other Procedure Output to Get the Results That You Need
http://support.sas.com/papers/delgobbo-ods2018
Vince DelGobbo
SAS R&D
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.