I am trying to make a new variable that shows if people have a higher value in one variable than another.
For example, ideally I would have
...
Announcement
Collapse
No announcement yet.
37 results in 0.0057 seconds.
egen
x
You can also choose from the popular tags.

Generate var3 for if var1>var2
 2 posts

Generate a new variable
I am trying to generate a variable for the age of the oldest male in the household.
So, I am using the variables from the household roster in the...
 4 posts

Origin Dest Airline Data
Dear stata users, per year quarter I've information on origin and destination for the airlines in the US. I want to generate a new variable (frequency)...
 5 posts

generate new variable using egen with sum/count
Hello everyone, hope you all have a good day ahead.
So i want to ask 1 question.. i have a data set which consist of ID, Year, Dummy_rich....
 2 posts

 3 posts

Computing average productivity per weekday and weekend
Hi everyone,
I have a dataset which more or less looks like the one provided below. For this dataset, I want to calculate the average number...
 6 posts

Keep rows if two consecutive columns have the same value
I am trying to filter rows based on a condition where two consequtive columns have a particular value. Say I have the following data consisting of an...
 12 posts

egen's anycount() incorrectly counting
I have a list of 23 variables that can have a value between 1 and 12. I would like to get the number of variables in a given row that have a certain value....
 8 posts

Jeffery Sauer started a topic Subsetting variable lists with other variable lists, and then using the result in gen/egen?in GeneralSubsetting variable lists with other variable lists, and then using the result in gen/egen?
Dear STATA Forum,
Perhaps this is a relatively simple request and I am just not thinking about it in the correct way (most of my background...
 6 posts

Beginner: Frequency of variable in dataset
I tried a few egen commands to do what I need, but can't figure it out.
I want to create a new variable that returns a total by each unique...
 3 posts

Work by family instead of individual
Hello, I am working with a public survey database that gathers data at the household, family and individual level. Meaning, in each household there is...Last edited by Fernanda Pavez; 07 Sep 2018, 13:17.
 3 posts

rowmax returning observation number, not max within row
Dear all,
For some reason, when I run this code on my dataset, egen creates a variable containing the observation number of each row instead...
 4 posts

Creating a sum of variables when there are no missing values (.)
Hello all, I'm a relatively new Stata user.
I have a set of variables that are the responses to a survey, and I need to create a variable...
 7 posts

select middle number with egn
Hello everyone. I have 5 variables as below:
Id d1 d2 d3 d4
1 2 2 3 4
i used egen=rowmin(d1d4) rowmax(d1d4)...
 7 posts

Procedure to group variable with minimum number of observations
Dear Statalists,
I have a discrete variable, that takes integer values larger or equal to zero. I want to cut the values into categories...
 3 posts