BookmarkSubscribeRSS Feed
jopo12345678
Calcite | Level 5

Hello everyone,

I am beginner in SAS

I have this table

SNAPSHOTCOUNTSEGMENTGROUPdefGRADE
2014014472PRK_LNPL001
2014018691PRK_LNPL002
2014018289PRK_LNPL003
2014012209PRK_LNPL004
2014011450PRK_LNPL005
2014011333PRK_LNPL006
201401364PRK_LNPL007
201401133PRK_LNPL008
2014014PRK_LNPL011
20140122PRK_LNPL012
20140181PRK_LNPL013
20140161PRK_LNPL014
20140167PRK_LNPL015
201401161PRK_LNPL016
201401122PRK_LNPL017
201401130PRK_LNPL018
20140111642PRK_LNPL101
20140119361PRK_LNPL102
20140115284PRK_LNPL103
2014013463PRK_LNPL104
2014012056PRK_LNPL105
2014011895PRK_LNPL106
201401490PRK_LNPL107
201401153PRK_LNPL108
2014019PRK_LNPL111
20140159PRK_LNPL112
201401141PRK_LNPL113
20140198PRK_LNPL114
201401114PRK_LNPL115
201401218PRK_LNPL116
201401189PRK_LNPL117
201401180PRK_LNPL118

I want this table

SNAPSHOTCOUNTSEGMENTGROUPdefGRADESUMDR
2014014472PRK_LNPL0014476 
2014018691PRK_LNPL0028713 
2014018289PRK_LNPL0038370 
2014012209PRK_LNPL0042270 
2014011450PRK_LNPL0051517 
2014011333PRK_LNPL0061494 
201401364PRK_LNPL007486 
201401133PRK_LNPL008263 
2014014PRK_LNPL011 0,089%
20140122PRK_LNPL012 0,252%
20140181PRK_LNPL013 0,968%
20140161PRK_LNPL014 2,687%
20140167PRK_LNPL015 4,417%
201401161PRK_LNPL016 10,776%
201401122PRK_LNPL017 25,103%
201401130PRK_LNPL018 49,430%
20140111642PRK_LNPL10111651 
20140119361PRK_LNPL10219420 
20140115284PRK_LNPL10315425 
2014013463PRK_LNPL1043561 
2014012056PRK_LNPL1052170 
2014011895PRK_LNPL1062113 
201401490PRK_LNPL107679 
201401153PRK_LNPL108333 
2014019PRK_LNPL111 0,077%
20140159PRK_LNPL112 0,304%
201401141PRK_LNPL113 0,914%
20140198PRK_LNPL114 2,752%
201401114PRK_LNPL115 5,253%
201401218PRK_LNPL116 10,317%
201401189PRK_LNPL117 27,835%
201401180PRK_LNPL118 54,054%

In column SUM i need to sum values in column COUNT for each grade and group seperatedly example 4476=4472+4.

In column DR i need to divide value from column COUNT and SUM for each grade and group seperatedly and only there where is in column DEF value=1. example 0,089%=4/4476.

Is here anybody who can solve my problem?

1 REPLY 1
Kurt_Bremser
Super User

Use proc summary with class group grade;

Then remerge the results with your dataset, and set variables according to def.

If you want fitting code, please post your dataset in a data step so we can fit the code to the data.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 686 views
  • 0 likes
  • 2 in conversation