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;
... View more