Hi Statalist community,
I am running several latent profile analysis models. I have results and I am trying to put them in a neat table. Below is a sample dataset that I am using and the code to produce my estimates.
Below is closer to what I am looking to accomplish. I only want the average means for each variable in the tables. I copied and pasted the average means for each variable to a Excel spreadsheet but I am trying to avoid copying and pasting. Ultimately, I have to create tables for the 6, 7, and 8 class models, respectively. Thanks in advance.
I am running several latent profile analysis models. I have results and I am trying to put them in a neat table. Below is a sample dataset that I am using and the code to produce my estimates.
Code:
*use this sample dataset use https://www.stata-press.com/data/r17/gsem_lca2, clear *use a loop estimate a 6, 7, and 8 class model respectively *use the estimate store command to temporarily save the results forval i= 6/8 { gsem (glucose insulin sspg <- _cons), lclass(C `i') estimates store c`i' estimates stats c`i' } *Restore estimates for class 8 estimates restore c8 *Attempt to put results in a table esttab c8 using example.csv
Below is closer to what I am looking to accomplish. I only want the average means for each variable in the tables. I copied and pasted the average means for each variable to a Excel spreadsheet but I am trying to avoid copying and pasting. Ultimately, I have to create tables for the 6, 7, and 8 class models, respectively. Thanks in advance.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str7 var1 float var2 str7 var3 float var4 str4 var5 float var6 "glucose" . "insulin" . "sspg" . "1.C" 35.67478 "1.C" 14.58391 "1.C" 10.0838 "2.C" 50.32645 "2.C" 29.96239 "2.C" 24.98897 "3.C" 37.82966 "3.C" 21.84206 "3.C" 15.76958 "4.C" 60.283 "4.C" 15.09135 "4.C" 19.11259 "5.C" 47.2637 "5.C" 43.68931 "5.C" 26.44606 "6.C" 52.0267 "6.C" 63.56623 "6.C" 21.58144 "7.C" 94.65932 "7.C" 10.1219 "7.C" 30.85979 "8.C" 139.3733 "8.C" 4.591076 "8.C" 38.39949 end