I have a data set like below mention table
stroll | stid | stname | math | science | history | geography | total | class | grade |
111 | s111 | AA | 60 | 50 | 45 | 60 | 215 | I | B |
212 | s212 | BB | 70 | 50 | 30 | 60 | 210 | II | B |
324 | S324 | CC | 70 | 80 | 50 | 70 | 270 | III | A |
456 | S456 | DD | 60 | 70 | 60 | 60 | 250 | IV | A |
578 | S578 | EE | 70 | 30 | 30 | 60 | 190 | V | C |
678 | S678 | FF | 40 | 60 | 40 | 40 | 180 | VI | B |
789 | S789 | CC | 60 | 40 | 50 | 70 | 220 | VII | B |
987 | S987 | GG | 80 | 30 | 40 | 50 | 200 | IX | A |
I want to create a cross table using above data as below mention table like
student name verses total mark percentage | |||||||||||||||
stroll | stid | math | science | history | geography | AA | BB | CC | DD | EE | FF | GG | total | class | grade |
Please help me to solve this ASAP.
Thanks and Regards,
Ashwini
Can you describe what you want?
Do you just want to transpose the data? Or are you trying to summarize it in some way?
Dear Tom,
I want a summarized data .
I want to create a cross table contain as below mention table .I want percentage each student as mention below report
student name * total mark percentage | |||||||||||||||
stroll | stid | math | science | history | geography | AA | BB | CC | DD | EE | FF | GG | total | class | grade |
Still doesn't make any sense. Perhaps if you put in some actual numbers?
What are the variable STROLL and STID? They look to me like student ID numbers. So do you want one row per student? Then what variable are you summarizing away? Why do you still have columns for MATH, SCIENCE, etc if you want to summarize grades?
You seem to want to make columns for each student (assuming the variable STNAME is student name). What number is it that you want to appear under column for when STNAME='AA'? How many rows do you expect to see in the result for your sample data?
As Tom said, still can't understand what you want .
data have; infile datalines expandtabs; input stroll $ stid $ stname $ math science history geography total class $ grade $; datalines; 111 s111 AA 60 50 45 60 215 I B 212 s212 BB 70 50 30 60 210 II B 324 S324 CC 70 80 50 70 270 III A 456 S456 DD 60 70 60 60 250 IV A 578 S578 EE 70 30 30 60 190 V C 678 S678 FF 40 60 40 40 180 VI B 789 S789 CC 60 40 50 70 220 VII B 987 S987 GG 80 30 40 50 200 IX A ; run; proc tabulate data=have; class stroll stid math science history geography class grade stname ; var total ; table stroll*stid*math *science* history* geography* class* grade ,stname*total*pctsum; run;
Ksharp
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.