Hi ,
I have 20 variables representing an outcome measure.
The same outcome/variable was measure twice at t1 and t2.
My setup is wide and I use Stata 16.1:
var1_1 var1_2 var2_1 var2-2............var20_1 var20_2
I would like to use a loop and generate for each pair of variables the difference.
diff_var1==var1_2 -var1_1
diff _var2==var2_2-var2_1
.............................
diff_var20==var20_2-var20_1
Your help would be greatly appreciated.
Thank you,
Nikos
Related Posts with Generate the difference between 2 variables
Append command changes the content of observations of the appended fileI have an issue with the append command. I have a couple of stata files that contain three variable…
Comparing sub-categories of a categorical variable across two groupsHello. I am trying to create descriptive statistics across two groups (treatment and control) for a …
Regressions with Dummy VariablesArray Hi all, I am trying to replicate the following table. My code is as follows: foreach depende…
Exporting table of results of prtest for Two-sample test of proportions using VARIABLES NOT GROUPS !hello, everyone! I cannot find a way to export the results of prtest of a two-sample test of propor…
Foreach loop to populate missing observations of a variable from one year to multiple yearsI am working on several variables that i reshaped data from wide to long format and created a year v…
Subscribe to:
Post Comments (Atom)
0 Response to Generate the difference between 2 variables
Post a Comment