I'm a beginner using SAS and I was tasked with creating a table that looks like the following:
Group A Group B All
A B C D E F G H I J K L M
Age
n
mean(sd)
median
min-max
Gender
n
fl
ml
Race
n
white
asian
hispanic
black
The blanks in the table are just the calculations based on the criteria. What I've considered doing is the following but it doesn't look right and there are errors. Is there anyway to fix this or use proc freq/ proc tabulate if it's easier:
Libname test '/home/user/username';
DATA test;
SET test.test(keep = GROUP LETTER AGE GENDER RACE);
RUN;
PROC SORT DATA = test;
BY GROUP LETTER AGE GENDER RACE;
PROC MEANS DATA = test;
CLASS GROUP LETTER;
VAR AGE GENDER RACE;
RUN;
PROC PRINT DATA = test;
TITLE 'Demographics';
RUN;
PROC PRINT DATA=test;
RUN;
PROC TRANSPOSE DATA = test.test;
OUT = test.test;
BY GROUP LETTER;
VAR GROUP LETTER;
RUN;
PROC REPORT DATA = asl.asl;
COLUMN GROUP LETTER AGE GENDER RACE;
DEFINE GROUP /DISPLAY 'Group';
DEFINE LETTER /DISPLAY 'Letter';
DEFINE AGE /DISPLAY 'Age';
DEFINE GENDER /DISPLAY 'Gender';
DEFINE RACE /DISPLAY 'Race';
RUN;