I have the following dataset (below) and I want to convert the variables "tfertrate", "mofertrate", "tafertrate" to numeric. I tried to do it with the command "encode# but the numbers that appear in the upper bar in the data editor don´t match the values of the observations. Can you help me with the code to convert this observations to numeric
Thank you in advance.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str31 territory int year str4 tfertrate str5(mofertrate fafertrate) long(tferrate motfertrate fatavrate) "Piemonte" 1999 "1,12" "30,6" "34,22" 12 43 30 "Piemonte" 2000 "1,17" "30,65" "34,31" 17 48 37 "Piemonte" 2001 "1,15" "30,68" "34,27" 15 50 35 "Piemonte" 2002 "1,2" "30,73" "34,46" 20 55 48 "Piemonte" 2003 "1,22" "30,96" "34,64" 22 75 63 "Piemonte" 2004 "1,26" "30,81" "34,7" 26 61 67 "Piemonte" 2005 "1,27" "30,96" "34,78" 27 75 74 "Piemonte" 2006 "1,32" "30,95" "34,8" 32 74 76 "Piemonte" 2007 "1,37" "30,96" "34,81" 37 75 77 "Piemonte" 2008 "1,41" "31,07" "34,84" 41 85 80 "Piemonte" 2009 "1,42" "31,09" "34,87" 42 87 83 "Piemonte" 2010 "1,42" "31,15" "34,81" 42 93 77 "Piemonte" 2011 "1,43" "31,3" "34,95" 43 108 91 "Piemonte" 2012 "1,43" "31,39" "34,99" 43 114 95 "Piemonte" 2013 "1,41" "31,45" "35,05" 41 119 101 "Piemonte" 2014 "1,41" "31,49" "35,06" 41 123 102 "Piemonte" 2015 "1,37" "31,69" "35,17" 37 142 112 "Piemonte" 2016 "1,36" "31,76" "35,25" 36 147 120 "Piemonte" 2017 "1,35" "31,82" "35,39" 35 152 133 "Piemonte" 2018 "1,3" "31,94" "35,41" 30 161 135 "Piemonte" 2019 "1,27" "32,07" "35,63" 27 172 153 "Piemonte" 2020 "1,25" "32,16" "35,49" 25 180 141 "Valle d'Aosta / Vallée d'Aoste" 1999 "1,19" "30,51" "33,89" 19 37 18 "Valle d'Aosta / Vallée d'Aoste" 2000 "1,27" "30,53" "34,31" 27 38 37 "Valle d'Aosta / Vallée d'Aoste" 2001 "1,22" "30,87" "34,57" 22 67 58 "Valle d'Aosta / Vallée d'Aoste" 2002 "1,25" "30,38" "34,38" 25 32 42 "Valle d'Aosta / Vallée d'Aoste" 2003 "1,28" "30,92" "34,73" 28 71 69 "Valle d'Aosta / Vallée d'Aoste" 2004 "1,33" "30,93" "34,49" 33 72 51 "Valle d'Aosta / Vallée d'Aoste" 2005 "1,34" "30,65" "34,44" 34 48 46 "Valle d'Aosta / Vallée d'Aoste" 2006 "1,44" "31,12" "34,98" 44 90 94 "Valle d'Aosta / Vallée d'Aoste" 2007 "1,47" "30,9" "34,75" 47 69 71 "Valle d'Aosta / Vallée d'Aoste" 2008 "1,57" "30,81" "34,6" 57 61 59 "Valle d'Aosta / Vallée d'Aoste" 2009 "1,62" "30,99" "34,75" 62 78 71 "Valle d'Aosta / Vallée d'Aoste" 2010 "1,62" "30,72" "34,33" 62 54 39 "Valle d'Aosta / Vallée d'Aoste" 2011 "1,6" "31,07" "34,96" 60 85 92 "Valle d'Aosta / Vallée d'Aoste" 2012 "1,57" "31,18" "34,75" 57 96 71 "Valle d'Aosta / Vallée d'Aoste" 2013 "1,44" "31,23" "35,01" 44 101 97 "Valle d'Aosta / Vallée d'Aoste" 2014 "1,54" "31,68" "35" 54 141 96 "Valle d'Aosta / Vallée d'Aoste" 2015 "1,41" "31,55" "35,17" 41 129 112 "Valle d'Aosta / Vallée d'Aoste" 2016 "1,42" "31,64" "34,85" 42 137 81 "Valle d'Aosta / Vallée d'Aoste" 2017 "1,35" "32,1" "35,62" 35 174 152 "Valle d'Aosta / Vallée d'Aoste" 2018 "1,39" "32,02" "35,62" 39 169 152 "Valle d'Aosta / Vallée d'Aoste" 2019 "1,31" "32,14" "35,4" 31 178 134 "Valle d'Aosta / Vallée d'Aoste" 2020 "1,23" "32,28" "35,68" 23 189 157 "Liguria" 1999 "0,99" "31,31" "34,98" 2 109 94 "Liguria" 2000 "1,04" "31,25" "35,06" 5 103 102 "Liguria" 2001 "1,06" "31,2" "34,9" 6 98 86 "Liguria" 2002 "1,09" "31,35" "35,2" 9 111 115 "Liguria" 2003 "1,11" "31,45" "34,88" 11 119 84 "Liguria" 2004 "1,18" "31,23" "35,22" 18 101 117 "Liguria" 2005 "1,19" "31,31" "35,18" 19 109 113 "Liguria" 2006 "1,24" "31,41" "35,38" 24 116 132 "Liguria" 2007 "1,28" "31,36" "35,26" 28 112 121 "Liguria" 2008 "1,35" "31,24" "35,24" 35 102 119 "Liguria" 2009 "1,36" "31,49" "35,39" 36 123 133 "Liguria" 2010 "1,35" "31,52" "35,19" 35 126 114 "Liguria" 2011 "1,33" "31,55" "35,25" 33 129 120 "Liguria" 2012 "1,38" "31,48" "35,3" 38 122 125 "Liguria" 2013 "1,35" "31,58" "35,27" 35 132 122 "Liguria" 2014 "1,35" "31,74" "35,37" 35 145 131 "Liguria" 2015 "1,32" "31,81" "35,45" 32 151 137 "Liguria" 2016 "1,31" "31,87" "35,53" 31 155 145 "Liguria" 2017 "1,29" "32,01" "35,66" 29 168 155 "Liguria" 2018 "1,24" "31,95" "35,58" 24 162 150 "Liguria" 2019 "1,21" "32,21" "35,88" 21 185 172 "Liguria" 2020 "1,23" "32,17" "35,75" 23 181 163 "Lombardia" 1999 "1,16" "30,87" "34,53" 16 67 54 "Lombardia" 2000 "1,21" "30,95" "34,6" 21 74 59 "Lombardia" 2001 "1,22" "30,96" "34,6" 22 75 59 "Lombardia" 2002 "1,26" "30,94" "34,78" 26 73 74 "Lombardia" 2003 "1,27" "31,11" "34,86" 27 89 82 "Lombardia" 2004 "1,36" "30,93" "34,93" 36 72 89 "Lombardia" 2005 "1,37" "31,02" "34,98" 37 81 94 "Lombardia" 2006 "1,43" "31,02" "35,04" 43 81 100 "Lombardia" 2007 "1,47" "31,04" "35,02" 47 83 98 "Lombardia" 2008 "1,53" "31,04" "34,99" 53 83 95 "Lombardia" 2009 "1,56" "31,1" "35,08" 56 88 104 "Lombardia" 2010 "1,56" "31,23" "35,15" 56 101 111 "Lombardia" 2011 "1,52" "31,39" "35,28" 52 114 123 "Lombardia" 2012 "1,51" "31,43" "35,34" 51 118 129 "Lombardia" 2013 "1,47" "31,53" "35,33" 47 127 128 "Lombardia" 2014 "1,46" "31,65" "35,4" 46 138 134 "Lombardia" 2015 "1,45" "31,79" "35,55" 45 149 147 "Lombardia" 2016 "1,43" "31,89" "35,54" 43 157 146 "Lombardia" 2017 "1,4" "32,02" "35,7" 40 169 159 "Lombardia" 2018 "1,36" "32,13" "35,71" 36 177 160 "Lombardia" 2019 "1,33" "32,19" "35,81" 33 183 168 "Lombardia" 2020 "1,27" "32,31" "35,8" 27 192 167 "Trentino Alto Adige / Südtirol" 1999 "1,45" "30,57" "34,6" 45 40 59 "Trentino Alto Adige / Südtirol" 2000 "1,46" "30,64" "34,74" 46 47 70 "Trentino Alto Adige / Südtirol" 2001 "1,46" "30,65" "34,68" 46 48 65 "Trentino Alto Adige / Südtirol" 2002 "1,45" "30,74" "34,82" 45 56 78 "Trentino Alto Adige / Südtirol" 2003 "1,46" "30,93" "34,96" 46 72 92 "Trentino Alto Adige / Südtirol" 2004 "1,55" "30,94" "35,1" 55 73 106 "Trentino Alto Adige / Südtirol" 2005 "1,55" "30,9" "35,11" 55 69 107 "Trentino Alto Adige / Südtirol" 2006 "1,54" "31,01" "35,17" 54 80 112 "Trentino Alto Adige / Südtirol" 2007 "1,57" "31,02" "35,08" 57 81 104 "Trentino Alto Adige / Südtirol" 2008 "1,61" "31,1" "35,13" 61 88 109 "Trentino Alto Adige / Südtirol" 2009 "1,58" "31,2" "35,04" 58 98 100 "Trentino Alto Adige / Südtirol" 2010 "1,63" "31,26" "35,18" 63 104 113 end format %ty year label values tferrate tferrate label def tferrate 2 "0,99", modify label def tferrate 5 "1,04", modify label def tferrate 6 "1,06", modify label def tferrate 9 "1,09", modify label def tferrate 11 "1,11", modify label def tferrate 12 "1,12", modify label def tferrate 15 "1,15", modify label def tferrate 16 "1,16", modify label def tferrate 17 "1,17", modify label def tferrate 18 "1,18", modify label def tferrate 19 "1,19", modify label def tferrate 20 "1,2", modify label def tferrate 21 "1,21", modify label def tferrate 22 "1,22", modify label def tferrate 23 "1,23", modify label def tferrate 24 "1,24", modify label def tferrate 25 "1,25", modify label def tferrate 26 "1,26", modify label def tferrate 27 "1,27", modify label def tferrate 28 "1,28", modify label def tferrate 29 "1,29", modify label def tferrate 30 "1,3", modify label def tferrate 31 "1,31", modify label def tferrate 32 "1,32", modify label def tferrate 33 "1,33", modify label def tferrate 34 "1,34", modify label def tferrate 35 "1,35", modify label def tferrate 36 "1,36", modify label def tferrate 37 "1,37", modify label def tferrate 38 "1,38", modify label def tferrate 39 "1,39", modify label def tferrate 40 "1,4", modify label def tferrate 41 "1,41", modify label def tferrate 42 "1,42", modify label def tferrate 43 "1,43", modify label def tferrate 44 "1,44", modify label def tferrate 45 "1,45", modify label def tferrate 46 "1,46", modify label def tferrate 47 "1,47", modify label def tferrate 51 "1,51", modify label def tferrate 52 "1,52", modify label def tferrate 53 "1,53", modify label def tferrate 54 "1,54", modify label def tferrate 55 "1,55", modify label def tferrate 56 "1,56", modify label def tferrate 57 "1,57", modify label def tferrate 58 "1,58", modify label def tferrate 60 "1,6", modify label def tferrate 61 "1,61", modify label def tferrate 62 "1,62", modify label def tferrate 63 "1,63", modify label values motfertrate motfertrate label def motfertrate 32 "30,38", modify label def motfertrate 37 "30,51", modify label def motfertrate 38 "30,53", modify label def motfertrate 40 "30,57", modify label def motfertrate 43 "30,6", modify label def motfertrate 47 "30,64", modify label def motfertrate 48 "30,65", modify label def motfertrate 50 "30,68", modify label def motfertrate 54 "30,72", modify label def motfertrate 55 "30,73", modify label def motfertrate 56 "30,74", modify label def motfertrate 61 "30,81", modify label def motfertrate 67 "30,87", modify label def motfertrate 69 "30,9", modify label def motfertrate 71 "30,92", modify label def motfertrate 72 "30,93", modify label def motfertrate 73 "30,94", modify label def motfertrate 74 "30,95", modify label def motfertrate 75 "30,96", modify label def motfertrate 78 "30,99", modify label def motfertrate 80 "31,01", modify label def motfertrate 81 "31,02", modify label def motfertrate 83 "31,04", modify label def motfertrate 85 "31,07", modify label def motfertrate 87 "31,09", modify label def motfertrate 88 "31,1", modify label def motfertrate 89 "31,11", modify label def motfertrate 90 "31,12", modify label def motfertrate 93 "31,15", modify label def motfertrate 96 "31,18", modify label def motfertrate 98 "31,2", modify label def motfertrate 101 "31,23", modify label def motfertrate 102 "31,24", modify label def motfertrate 103 "31,25", modify label def motfertrate 104 "31,26", modify label def motfertrate 108 "31,3", modify label def motfertrate 109 "31,31", modify label def motfertrate 111 "31,35", modify label def motfertrate 112 "31,36", modify label def motfertrate 114 "31,39", modify label def motfertrate 116 "31,41", modify label def motfertrate 118 "31,43", modify label def motfertrate 119 "31,45", modify label def motfertrate 122 "31,48", modify label def motfertrate 123 "31,49", modify label def motfertrate 126 "31,52", modify label def motfertrate 127 "31,53", modify label def motfertrate 129 "31,55", modify label def motfertrate 132 "31,58", modify label def motfertrate 137 "31,64", modify label def motfertrate 138 "31,65", modify label def motfertrate 141 "31,68", modify label def motfertrate 142 "31,69", modify label def motfertrate 145 "31,74", modify label def motfertrate 147 "31,76", modify label def motfertrate 149 "31,79", modify label def motfertrate 151 "31,81", modify label def motfertrate 152 "31,82", modify label def motfertrate 155 "31,87", modify label def motfertrate 157 "31,89", modify label def motfertrate 161 "31,94", modify label def motfertrate 162 "31,95", modify label def motfertrate 168 "32,01", modify label def motfertrate 169 "32,02", modify label def motfertrate 172 "32,07", modify label def motfertrate 174 "32,1", modify label def motfertrate 177 "32,13", modify label def motfertrate 178 "32,14", modify label def motfertrate 180 "32,16", modify label def motfertrate 181 "32,17", modify label def motfertrate 183 "32,19", modify label def motfertrate 185 "32,21", modify label def motfertrate 189 "32,28", modify label def motfertrate 192 "32,31", modify label values fatavrate fatavrate label def fatavrate 18 "33,89", modify label def fatavrate 30 "34,22", modify label def fatavrate 35 "34,27", modify label def fatavrate 37 "34,31", modify label def fatavrate 39 "34,33", modify label def fatavrate 42 "34,38", modify label def fatavrate 46 "34,44", modify label def fatavrate 48 "34,46", modify label def fatavrate 51 "34,49", modify label def fatavrate 54 "34,53", modify label def fatavrate 58 "34,57", modify label def fatavrate 59 "34,6", modify label def fatavrate 63 "34,64", modify label def fatavrate 65 "34,68", modify label def fatavrate 67 "34,7", modify label def fatavrate 69 "34,73", modify label def fatavrate 70 "34,74", modify label def fatavrate 71 "34,75", modify label def fatavrate 74 "34,78", modify label def fatavrate 76 "34,8", modify label def fatavrate 77 "34,81", modify label def fatavrate 78 "34,82", modify label def fatavrate 80 "34,84", modify label def fatavrate 81 "34,85", modify label def fatavrate 82 "34,86", modify label def fatavrate 83 "34,87", modify label def fatavrate 84 "34,88", modify label def fatavrate 86 "34,9", modify label def fatavrate 89 "34,93", modify label def fatavrate 91 "34,95", modify label def fatavrate 92 "34,96", modify label def fatavrate 94 "34,98", modify label def fatavrate 95 "34,99", modify label def fatavrate 96 "35", modify label def fatavrate 97 "35,01", modify label def fatavrate 98 "35,02", modify label def fatavrate 100 "35,04", modify label def fatavrate 101 "35,05", modify label def fatavrate 102 "35,06", modify label def fatavrate 104 "35,08", modify label def fatavrate 106 "35,1", modify label def fatavrate 107 "35,11", modify label def fatavrate 109 "35,13", modify label def fatavrate 111 "35,15", modify label def fatavrate 112 "35,17", modify label def fatavrate 113 "35,18", modify label def fatavrate 114 "35,19", modify label def fatavrate 115 "35,2", modify label def fatavrate 117 "35,22", modify label def fatavrate 119 "35,24", modify label def fatavrate 120 "35,25", modify label def fatavrate 121 "35,26", modify label def fatavrate 122 "35,27", modify label def fatavrate 123 "35,28", modify label def fatavrate 125 "35,3", modify label def fatavrate 128 "35,33", modify label def fatavrate 129 "35,34", modify label def fatavrate 131 "35,37", modify label def fatavrate 132 "35,38", modify label def fatavrate 133 "35,39", modify label def fatavrate 134 "35,4", modify label def fatavrate 135 "35,41", modify label def fatavrate 137 "35,45", modify label def fatavrate 141 "35,49", modify label def fatavrate 145 "35,53", modify label def fatavrate 146 "35,54", modify label def fatavrate 147 "35,55", modify label def fatavrate 150 "35,58", modify label def fatavrate 152 "35,62", modify label def fatavrate 153 "35,63", modify label def fatavrate 155 "35,66", modify label def fatavrate 157 "35,68", modify label def fatavrate 159 "35,7", modify label def fatavrate 160 "35,71", modify label def fatavrate 163 "35,75", modify label def fatavrate 167 "35,8", modify label def fatavrate 168 "35,81", modify label def fatavrate 172 "35,88", modify
0 Response to Convert variables to numeric
Post a Comment