Hi— I’m very new to using Base SAS and Pro SQL to create Numeric transformations. I’m having a little trouble figuring this out. I am using a survey were each response translates into a point value. The data set has I have 500 observations each belong to an agency. After the dataset is recoded, the data set looks like this. Agency Q1n Q1d Q2n Q2d Q3n Q3d Q4n Q4d Q5n Q5d AgencyA 1 1 1 1 0 2 1 2 0 0 AgencyA 0 0 2 2 1 1 2 1 2 2 AgencyA 0 0 0 0 0 0 0 0 0 0 AgencyB 1 1 1 1 1 1 0 1 1 1 AgencyB 0 0 0 0 0 0 1 0 0 0 AgencyC 2 2 1 2 0 0 2 0 2 2 AgencyC 1 1 2 2 0 2 2 2 1 1 AgencyC 2 2 1 1 2 2 2 2 1 2 AgencyD 1 1 1 1 1 1 0 1 1 1 AgencyD 1 1 1 2 1 1 2 1 1 2 AgencyD 1 1 2 2 1 1 1 1 1 2 AgencyD 0 0 0 0 0 0 0 0 0 0 Then I have to generate a score for each agency. So, then I need to add up all the QNs and then add up all the QDs and then divide which awards the score. This has to be aggregated by agency. Total Agency Sum Numerator=Q1N + Q2N + Q3N + Q4N + Q5N + Q6N + Q7N + Q8N + Q9N + Q10N+ Q11N Total Agency Sum Denominator =Q1D + Q2D + Q3D + Q4D + Q5D + Q6D + Q7D + Q8D + Q9D + Q10N + Q11N Agency Score= Total Agency Sum Numerator Numerator / Total Agency Sum Numerator Denominator. Below is the code I have – I’m having a little trouble, figuring this out. BASE SAS data have; set want; Sumn= sum(Q1N, Q2N, Q3N ,Q4N, Q5N ,Q6N ,Q7N ,Q8N ,Q9N, Q11N); Sumd= sum(Q1D, Q2D, Q3D ,Q4D, Q5D ,Q6D ,Q7D ,Q8D ,Q9D, Q11D); group by***what is the equivalent of group by for base SAS?*** AGENCY; run; PROC SQL proc sql; create table want as select distinct AGENCY, sum(Q1N, Q2N, Q3N ,Q4N, Q5N ,Q6N ,Q7N ,Q8N ,Q9N, Q11N) as Sumn, sum(Q1D, Q2D, Q3D ,Q4D, Q5D ,Q6D ,Q7D ,Q8D ,Q9D, Q11D) as Sumd, calculated sum(Sumn) as sumtn, calculated sum(Sumd) as sumtd from have group by AGENCY; quit; THANKS!!!!!!!!
... View more