Hi everyone,
I want to sum a variable and then assign its highest value +1 to an observation. The variable is called cluster and when I summarize it, max=2412. The observation is identified by the town_code 1997.
I tried to do this using (variable names are inclinated):
sum cluster
replace cluster= ( r(max) + 1 ) if town_code==1997
But nothing's changed. Is it even possible to assign r(max) to a variable in any way?
And can someone think of another way to automatically assign that observation (and others) with values of cluster that aren't assigned yet? (all these observations currently hold the value 1 in cluster).
Thanks a lot in advance,
Ben
Related Posts with Assigning a result from summarize to a variable
panel data - format dateHello everyone, I have a paneldataset ranging from 2002 to 2019 with all companies from the s&p…
Conditional ttest command in StataDear colleagues. What is the appropriate Stata command to test for the assumption below? Array Tha…
save as .exp fileGood Morning, a client wants to have a stata dataset in SAS. Therefore I exported the data as a v8x…
How to replace specific values with string?Hi I am suffering from a annoying situation. In my data set, a variable is like below, Code: comm…
Multiple Baseline DesignHello Everyone. I have been following STATALIST for a while now and really appreciative of its help.…
Subscribe to:
Post Comments (Atom)
0 Response to Assigning a result from summarize to a variable
Post a Comment