Hi All
I want to sum variable by sorting two variables as see my sample data set in below ;
I used the code :
bysort userphoneno(actiondescription): egen double sum_subsection=sum(dif_min)
but sum_subsection is summary of all observations and really I want to get sum of observation within same 'actiondescription' ,
Please suggest me like according to 'actiondescription' variable , sum of ""Baby_ProdcutDetail" for 'dif_min' .
There is different observation under 'userphoneno' variable.
I want to sum variable by sorting two variables as see my sample data set in below ;
I used the code :
bysort userphoneno(actiondescription): egen double sum_subsection=sum(dif_min)
but sum_subsection is summary of all observations and really I want to get sum of observation within same 'actiondescription' ,
Please suggest me like according to 'actiondescription' variable , sum of ""Baby_ProdcutDetail" for 'dif_min' .
There is different observation under 'userphoneno' variable.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str11 userphoneno str22 actiondescription float dif_min double sum_subsection "09424319384" "Baby_ProdcutDetail" .08333334 48.833333510905504 "09424319384" "Baby_ProdcutDetail" .26666668 48.833333510905504 "09424319384" "Baby_ProdcutDetail" .65 48.833333510905504 "09424319384" "Baby_ProdcutDetailItem" .2 48.833333510905504 "09424319384" "Baby_ProdcutDetailItem" .11666667 48.833333510905504 "09424319384" "ChatConversation" 0 48.833333510905504 "09424319384" "ChatConversation" 1.1833333 48.833333510905504 "09424319384" "ChatConversation" .08333334 48.833333510905504 "09424319384" "ChatRoom" .05 48.833333510905504 "09424319384" "ChatRoom" .016666668 48.833333510905504 "09424319384" "Dashboard" .06666667 48.833333510905504 "09424319384" "Dashboard" .033333335 48.833333510905504 "09424319384" "Dashboard" .016666668 48.833333510905504 "09424319384" "Dashboard" .05 48.833333510905504 "09424319384" "Dashboard" .05 48.833333510905504 "09424319384" "Dashboard" .06666667 48.833333510905504 "09424319384" "DoctorLocator" .2 48.833333510905504 "09424319384" "DoctorLocator" .26666668 48.833333510905504 "09424319384" "DoctorLocatorList" .21666667 48.833333510905504 "09424319384" "InAppNotification" 0 48.833333510905504 "09424319384" "InAppNotification" .016666668 48.833333510905504 "09424319384" "LessonChoose" 1.9333333 48.833333510905504 "09424319384" "LessonChoose" 1.2166667 48.833333510905504 "09424319384" "LessonChoose" 1.75 48.833333510905504 "09424319384" "NewsFeed" .06666667 48.833333510905504 "09424319384" "NewsFeed" .016666668 48.833333510905504 "09424319384" "NewsFeed" .016666668 48.833333510905504 "09424319384" "NewsFeed" .7166666 48.833333510905504 "09424319384" "NewsFeed" 0 48.833333510905504 "09424319384" "NewsFeed" .06666667 48.833333510905504 "09424319384" "NewsFeed" .8666667 48.833333510905504 "09424319384" "NewsFeed" .1 48.833333510905504 "09424319384" "ProviderDetail" 5.016667 48.833333510905504 "09424319384" "Quiz" .3333333 48.833333510905504 "09424319384" "Quiz" .033333335 48.833333510905504 "09424319384" "Quiz" .15 48.833333510905504 "09424319384" "Quiz" .016666668 48.833333510905504 "09424319384" "Quiz" .13333334 48.833333510905504 "09424319384" "Referral" .3 48.833333510905504 "09424319384" "Referral" .05 48.833333510905504 "09424319384" "Referral" .08333334 48.833333510905504 "09424319384" "Reminder" .08333334 48.833333510905504 "09424319384" "Save_Post" .08333334 48.833333510905504 "09424319384" "Settings" 30 48.833333510905504 "09424319384" "Settings" .9 48.833333510905504 "09424319384" "Settings" 0 48.833333510905504 "09424319384" "Shopping" .4 48.833333510905504 "09424319384" "Symptoms" .1 48.833333510905504 "09424319384" "WeeklyMessage" .7666667 48.833333510905504 end
Comment