Hello,
I want to create a table (please see an attached file) from the data set below:
DATA data1;
input id age sex;
DATALINES;
1 1 1
2 2 2
3 3 2
4 1 2
5 1 1
6 3 1
7 1 1
8 2 2
9 1 1
;
run;
I can get numbers running multiple 'proc freq';
proc sort data=data1 out=data1_sort; by exp; run;
proc freq data=data1_sort;
table age sex;
run;
proc freq data=data1_sort;
table age;
by exp;
run;
proc freq data=data1_sort;
table sex;
by exp;
run;
But, I have to copy and paste the results.
Is there a way(s) to get the table directly from the data set without copying and pasting results?
Thank you,
Yoko
can you paste the wanted output here rather than attachment?
Also,where is exp variable in data1?
still no.
I ran your code to make a guess to figure out your expected output but my dumb brain isn't picking it
Post any code or related comments in the right place. In the editor window you have a running man to add your code and {i} for adding any log info and so on.
Ok, in that case, delete this one as to avoid duplication.
secondly, @SuryaKiran has recommended the way to post in the right way
@Yoko wrote:
It looks that I cannot delete my post once I receive responses.
I'll try to find out how to show my table properly..
(my second attempt seemed to have failed.)
Thank you,
Yoko
Perhaps a screen capture, create image file as jpeg or png and use the PHOTOS icon here to upload the picture.
This is a shot in the dark, since you still need to show more of what you need. But this likely comes close to what you are asking for:
proc tabulate data=have missing;
class exp age sex;
tables exp age sex, n pctn;
run;
There are a lot of things to play with using PROC TABULATE, to control the format of the table.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.