I have a database with three variables: 27 states, 10 years and a GDP for each year. I want to generate a variable with the resulting logical operation: if year=2017, then GDP*2 & if year=2018, then GDP*7 & if year=2019, then GDP*15, and so on.
How can I do that, please?
Related Posts with Logic operations with generate
bysort query issuesHello all:
I am trying to replace first row of path with "CLL" and second row of path as "RT" for _…
create a loop to convert string variables in numeric variablesHello,
I am Salvatore, happy to join the Stata Forum community.
I am a new user who recently started…
Matching without replacement from a file of pairs for case-control and other applicationsShort version: I’m seeking a solution to how to do 1:m matching of cases and controls without replac…
Shortcut for generating new variables based on many existingI have groups of variables contactoutcome_con_<y>_<x> and contactmethod_con_<y>_&l…
Replace command with non-mutually exclusive categorical dataHello,
I am working with a dataset from a Twitter content analysis project and am stuck trying out …
Subscribe to:
Post Comments (Atom)
0 Response to Logic operations with generate
Post a Comment