DATA Step, Macro, Functions and more

how to create multiple dimension table for repporting

Reply
Frequent Contributor
Posts: 76

how to create multiple dimension table for repporting

I have a data set like below mention table

strollstidstnamemathsciencehistorygeographytotalclassgrade
111s111AA60504560215IB
212s212BB70503060210IIB
324S324CC70805070270IIIA
456S456DD60706060250IVA
578S578EE70303060190VC
678S678FF40604040180VIB
789S789CC60405070220VIIB
987S987GG80304050200IXA

I want to create a cross table using above data as below mention table like

student name verses total mark percentage
strollstid mathsciencehistorygeographyAABBCCDDEEFFGGtotalclassgrade

Please help me to solve this ASAP.

Thanks and Regards,

Ashwini

Super User
Super User
Posts: 6,502

Re: how to create multiple dimension table for repporting

Can you describe what you want?

Do you just want to transpose the data? Or are you trying to summarize it in some way?

Frequent Contributor
Posts: 76

Re: how to create multiple dimension table for repporting

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
strollstidmathsciencehistorygeographyAABBCCDDEEFFGGtotalclassgrade
Super User
Super User
Posts: 6,502

Re: how to create multiple dimension table for repporting

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?

Super User
Posts: 9,691

Re: how to create multiple dimension table for repporting

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

Ask a Question
Discussion stats
  • 4 replies
  • 203 views
  • 0 likes
  • 3 in conversation