I have data that looks like the following
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double(it_budget100_657 it_budget101_1267 it_budget102_730 it_budget103_1000 it_budget104_64) 56810 . . 28136 3475 131975 . . 14813 12850 367000 . . 29000 22914.84765625 331000 . . 24000 39438.359375 276000 . . 21000 30441.775390625 105000 . . 13000 11991.0087890625 131300 129 151500 . 20285 241794 . 275696 . 34261 278940 . 276936 . 36480 277691 . 275696 . 275696 276178 . 274194 . 274194 253459 . 274194 . . end
For example, in the first loop I would extract the number 100 somehow and then save this as a local. Within this loop, I would extract the next number 101 and then check to see if it is the same as 100. If so, I would use pwcorr to calculate correlations between the two vectors.
For context, the first number corresponds to a bank (like Wells Fargo), and each variable is a unique branch-bank pair (so some Wells Fargo in the United States). What I want to do is calculate correlations for branches that are not in the same bank. Hence, this is why I would like to skip the branches that have the same first number. I am really only struggling with how to extract the first number from each variable name. Thanks for any help!
0 Response to Extracting the first number from a variable name
Post a Comment