I have three different variables in Stata, var1
, var2
, and var3
.
I need to make a summary table of these three variables so that I have the observation number, mean, sd, min, max as the fields in the resulting summary table.
I am using the following code :
su var1 if restriction == 2
su var2 if restriction == 3
su var3 if restriction == 4
Since the summary table is created from variables that are applied with restrictions, I am unable to use :
su var1 var2 var3
I would be very grateful if anyone has any ideas on how to modify my code so that instead of three lines of code I can use one line of code to get a single table will all the stats I require, which I can then copy as a table into my Word document.
Nothing reproducible here without example data. Please study https://stackoverflow.com/help/mcve
But I would go
gen var1_2 = var1 if restriction == 2
gen var2_3 = var2 if restriction == 3
gen var3_4 = var3 if restriction == 4
summarize var1_2 var2_3 var3_4