Hi all,
I am working on this dataset which has a string variable (named "lga_perc_covered") that provides information on all geographical areas an identifier (named "sa2_name") falls in, along with the proportion of area covered.
What I would like to is:
1. Split the string variable "lga_perc_covered" into several variables which denotes the Local Government Area (LGA) an identifier falls in and also the proportion of identifier that lies in a LGA. For ex, in row 2, the SA2 area 'Goulburn Region' lies in two LGAs - Upper Lachlan Shire (A) and Queanbeyan-Palerang Regional (A). And 67.59% of Goulburn region is in Upper Lachlan Shire (A) LGA and the remaining area is in Queanbeyan-Palerang Regional (A) LGA. All these information are available in the variable 'lga_perc_covered'.
2. Now, I would like to split this 'lga_perc_covered' into several variables (such as LGA1, LGA1_Perc, LGA2 and LGA2_Perc) that provides information on which LGA a SA2 falls in and the proportion of SA2 that falls in a LGA.
3. Finally, create a set of variables called 'LGA_Max' and 'LGA_Perc_Max' that lists the LGA which has the most percentage of a SA2 area. For example, for row 2, Upper Lachlan Shire (A) LGA contains the highest proportion of Goulburn region SA2 i.e. 67.59%.
Thanks for your help.
Regards
Vignesh.
I am working on this dataset which has a string variable (named "lga_perc_covered") that provides information on all geographical areas an identifier (named "sa2_name") falls in, along with the proportion of area covered.
What I would like to is:
1. Split the string variable "lga_perc_covered" into several variables which denotes the Local Government Area (LGA) an identifier falls in and also the proportion of identifier that lies in a LGA. For ex, in row 2, the SA2 area 'Goulburn Region' lies in two LGAs - Upper Lachlan Shire (A) and Queanbeyan-Palerang Regional (A). And 67.59% of Goulburn region is in Upper Lachlan Shire (A) LGA and the remaining area is in Queanbeyan-Palerang Regional (A) LGA. All these information are available in the variable 'lga_perc_covered'.
2. Now, I would like to split this 'lga_perc_covered' into several variables (such as LGA1, LGA1_Perc, LGA2 and LGA2_Perc) that provides information on which LGA a SA2 falls in and the proportion of SA2 that falls in a LGA.
3. Finally, create a set of variables called 'LGA_Max' and 'LGA_Perc_Max' that lists the LGA which has the most percentage of a SA2 area. For example, for row 2, Upper Lachlan Shire (A) LGA contains the highest proportion of Goulburn region SA2 i.e. 67.59%.
Thanks for your help.
Regards
Vignesh.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str3 state_name str40 sa2_name str575 lga_perc_covered str24 lga1 float lga1_perc str33 lga2 float lga2_perc str24 lga_max float lga_perc_max "NSW" "Goulburn" `"[{"lga" : "Goulburn Mulwaree (A)", "perc" : 100.00}]"' "Goulburn Mulwaree (A)" 100 "" . "Goulburn Mulwaree (A)" 100 "NSW" "Goulburn Region" `"[{"lga" : "Upper Lachlan Shire (A)", "perc" : 67.59}, {"lga" : "Queanbeyan-Palerang Regional (A)", "perc" : 32.41}]"' "Upper Lachlan Shire (A)" 67.59 "Queanbeyan-Palerang Regional (A)" 32.41 "Upper Lachlan Shire (A)" 67.59 "NSW" "Yass" `"[{"lga" : "Yass Valley (A)", "perc" : 100.00}]"' "Yass Valley (A)" 100 "" . "Yass Valley (A)" 100 "NSW" "Yass Region" `"[{"lga" : "Yass Valley (A)", "perc" : 67.84}, {"lga" : "Upper Lachlan Shire (A)", "perc" : 32.16},]"' "Yass Valley (A)" 67.84 "Upper Lachlan Shire (A)" 32.16 "Yass Valley (A)" 67.84 "NSW" "Young" `"[{"lga" : "Hilltops (A)", "perc" : 100.00}]"' "Hilltops (A)" 100 "" . "Hilltops (A)" 100 end
Comment