Here's my post from yesteday: https://www.statalist.org/forums/for...s-of-variables
Essentially, I am dealing with states as individual variables and their coverage of content as individual observations. The data for each state represents the amount of which said topic is covered in materials by the state; comparing two states at the same observation would show how much they have in common on that topic. Eventually, I want to sum how much they have in common as a score of how aligned the materials of the two states are.
Here's an example of my data
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double(US1 US7 US14 US24 US33) 0 0 0 0 0 0 0 0 0 0 .0095238095238095 0 0 0 0 0 0 0 .0076923076923077 0 0 0 0 0 0 end
egen US1US1 = rowmin (US1 US1)
egen US1US2 = rowmin (US1 US2)
until egen US1US39 (the last state where data is available)
And then I want the cycle to repeat.
Last, though this part of the loop would be simpler, but just in case you're wondering, I would sum the rowmins of an individual column to create each states' total alignment and then drop the rowmin variable.
Thanks in advance and stay safe wherever you are
0 Response to Creating a Loop to Generate all Possible Pairs in a Variable List
Post a Comment