SAS Data Table Using PROC REPORT
up vote
2
down vote
favorite
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;
stored-procedures sas tabular
add a comment |
up vote
2
down vote
favorite
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;
stored-procedures sas tabular
2
Bottom of the page you'll fin dthe link to a paper (and code) that illustrates how to do this. It's not as straightforward as it could be :( communities.sas.com/t5/SAS-Studio/Demographic-table-creation/…
– Reeza
Nov 8 at 22:52
1
Thanks so much Reeza. This is extremely helpful and I'm glad to see I'm not the only one scratching my head at this.
– Serena Lee
Nov 8 at 22:55
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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;
stored-procedures sas tabular
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;
stored-procedures sas tabular
stored-procedures sas tabular
edited Nov 9 at 8:04
Brian Tompsett - 汤莱恩
4,153133699
4,153133699
asked Nov 8 at 22:43
Serena Lee
977
977
2
Bottom of the page you'll fin dthe link to a paper (and code) that illustrates how to do this. It's not as straightforward as it could be :( communities.sas.com/t5/SAS-Studio/Demographic-table-creation/…
– Reeza
Nov 8 at 22:52
1
Thanks so much Reeza. This is extremely helpful and I'm glad to see I'm not the only one scratching my head at this.
– Serena Lee
Nov 8 at 22:55
add a comment |
2
Bottom of the page you'll fin dthe link to a paper (and code) that illustrates how to do this. It's not as straightforward as it could be :( communities.sas.com/t5/SAS-Studio/Demographic-table-creation/…
– Reeza
Nov 8 at 22:52
1
Thanks so much Reeza. This is extremely helpful and I'm glad to see I'm not the only one scratching my head at this.
– Serena Lee
Nov 8 at 22:55
2
2
Bottom of the page you'll fin dthe link to a paper (and code) that illustrates how to do this. It's not as straightforward as it could be :( communities.sas.com/t5/SAS-Studio/Demographic-table-creation/…
– Reeza
Nov 8 at 22:52
Bottom of the page you'll fin dthe link to a paper (and code) that illustrates how to do this. It's not as straightforward as it could be :( communities.sas.com/t5/SAS-Studio/Demographic-table-creation/…
– Reeza
Nov 8 at 22:52
1
1
Thanks so much Reeza. This is extremely helpful and I'm glad to see I'm not the only one scratching my head at this.
– Serena Lee
Nov 8 at 22:55
Thanks so much Reeza. This is extremely helpful and I'm glad to see I'm not the only one scratching my head at this.
– Serena Lee
Nov 8 at 22:55
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53217259%2fsas-data-table-using-proc-report%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Bottom of the page you'll fin dthe link to a paper (and code) that illustrates how to do this. It's not as straightforward as it could be :( communities.sas.com/t5/SAS-Studio/Demographic-table-creation/…
– Reeza
Nov 8 at 22:52
1
Thanks so much Reeza. This is extremely helpful and I'm glad to see I'm not the only one scratching my head at this.
– Serena Lee
Nov 8 at 22:55