I have station-level electric fuel price variable that is reported in different formats - per hour, usage, two part tariff, restrictions on these different formats, et cetra.
Ultimately, I would like to run some regressions with this price variable, and thus I am trying to clean this price variable and make it numerical.
Two questions -
1. Theoretical: I understand that this would distort the data - not only would I be losing information, but also potentially misrepresent some observations.
Was wondering if there is any justification for defending the clean price variable I create?
2. Empirical: I was thinking about dividing all the observations into a few categories, and then writing an observation cleaning code for each category.
Is there another more efficient way?
Thanks in advance.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input strL price "$0.05 per kWh" "$1 per hour, minimum payment of $1.5" "Level 2: $0.12 per kWh" "$3 per hour" "$1.35/Hr Parking Fee" "$0.5 per hour, $0.15 per kWh" "Pricing is based on length of time and kWh used. $0 per hour for the first 1 hour, and $1 per additional hour, $0.32 per kWh, maximum payment of $30" "Pricing is based on length of time. $0.6 per hour for the first 4 hours, and $5 per additional hour" "minimum payment of $3, maximum payment of $10, $3 per session" "$0.02 per hour, minimum payment of $1.2" "$0.1 per kWh" "Level 2: $0.59 per kWh" "Pricing is based on length of time and kWh used. $0 per hour for the first 3 hours, and $3 per additional hour, $0.13 per kWh, maximum payment of $20" "Pricing is based on length of time and kWh used. $0 per hour for the first 3 hours, and $20 per additional hour, $1 per kWh" "Level 2: $2.00 per hour, maximum payment of $40.00" "Pricing is based on length of time. $1 per hour for the first 3 hours, and $5 per additional hour, minimum payment of $1, maximum payment of $30" "$0.28 per kWh; $0.26 per minute above 60 kW and $0.13 per minute at or below 60 kW" "Pricing is based on length of time. $1 per hour for the first 2 hours, and $4 per additional hour, minimum payment of $1" "$1.67 per hour" "Level 2: $0.03 per 30 seconds" "$0.2 per kWh" "$0.00-$1.00/Hr Variable Parking Fee" "$0.2 per hour" "$0.13 per kWh" "Pricing is based on kWh used. $0.67 per kWh" "$0.15 per kWh, minimum payment of $0.15" "$1.5 per hour, minimum payment of $1.5, maximum payment of $9, maximum session time is 24 hours" "Pricing is based on length of time. $0.12 per hour for the first 4 hours, and $3 per additional hour, minimum payment of $0.5, maximum payment of $50" "$0.28 per kWh; $0.26 per minute above 60 kW and $0.13 per minute at or below 60 kW" "Pricing is by session. $2 per session, maximum session time is 5 hours" "$1 per hour" "$0.28 per kWh; $0.26 per minute above 60 kW and $0.13 per minute at or below 60 kW" "Pricing is based on length of time. $1.25 per hour for the first 4 hours, and $10 per additional hour" "$0.00-$1.00/Hr Variable Parking Fee, $0.32/kWh Energy Fee" "$0.28 per kWh; $0.26 per minute above 60 kW and $0.13 per minute at or below 60 kW" "Pricing is based on length of time. $1 per hour for the first 3 hours, and $5 per additional hour" "$2.00/Hr Parking Fee" "$2 per hour" "Level 2: $0.59 per kWh" "Level 2: $0.03 per 30 seconds" "Pricing is based on length of time. $1 per hour for the first 3 hours, and $5 per additional hour" "Level 2: $0.49 per kWh" "Pricing is based on length of time. $0 per hour for the first 1 hour, and $2 per additional hour" "Pricing is based on length of time. $0.05 per hour for the first 1 hour, and $0.1 per additional hour" "$1 per 4 hour for first four hours; $10 per hour thereafter" "$1.00/Hr Parking Fee" "Pricing is based on length of time. $1.5 per hour for the first 2 hours, and $20 per additional hour" "$0.28 per kWh" "$1 per kWh" "Pricing is based on an hourly rate. $1.5 per hour, minimum payment of $0.75, maximum session time is 24 hours" "$2 per hour" "Pricing is based on length of time. $1.5 per hour for the first 4 hours, and $10 per additional hour, minimum payment of $1.5" "$2.00/Hr Parking Fee" "Flat fee $2.50 plus $0.24 per kWh" "$0.00-$3.25/Hr Variable Parking Fee, $0.00-$0.25/kWh Variable Energy Fee" "Level 2: $0.59 per kWh" "$0.00-$2.00/Hr Variable Parking Fee, $0.13/kWh Energy Fee" "Level 2: $0.49 per kWh" "Level 2: $0.03 per 30 seconds" "$0.13 per kWh" "$0.00-$1.00/Hr Variable Parking Fee" "Pricing is based on length of time. $1.25 per hour for the first 4 hours, and $3 per additional hour, maximum payment of $24, maximum session time is 24 hours" "Pricing is based on length of time and kWh used. $0 per hour for the first 3 hours, and $5 per additional hour, $0.16 per kWh" "Pricing is based on length of time. $1.25 per hour for the first 4 hours, and $3 per additional hour, maximum payment of $24, maximum session time is 24 hours" "$2.00/Hr Parking Fee" "$0.25 per hour" "$0.26 per kWh" "$0.49 per kWh, first 5 minutes free, minimum payment of $0.50" "Pricing is based on length of time. $1 per hour for the first 4 hours, and $5 per additional hour" "Pricing is based on length of time and kWh used. $0 per hour, and $5 per additional hour, $0.15 per kWh" "$1.50 per hour" "$0.5 per kWh, maximum payment of $25, $2.5 per session" "$1 per hour" "Pricing is based on length of time. $0.5 per hour for the first 2 hours, and $10 per additional hour" "$0.2 per kWh" "Pricing is based on length of time. $1.5 per hour for the first 3 hours, and $5 per additional hour" "$0.49 per kWh, minimum payment of $1" "Pricing is based on length of time. $0 per hour, and $10 per additional hour, maximum payment of $50" "$2 per hour, minimum payment of $2" "Level 2: $0.49 per kWh" "$0.3 per hour" "$0.25 per kWh" "Pricing is based on length of time and kWh used. $0.31 per hour for the first 4 hours, and $1.15 per additional hour, $0.12 per kWh" "Pricing is based on length of time and kWh used. $0 per hour, and $0.25 per additional hour, $0.3 per kWh" "Level 2: $0.49 per kWh" "Pricing is based on length of time and kWh used. $0 per hour for the first 1 hour, and $3 per additional hour, $0.25 per kWh" "Pricing is based on length of time. $1.25 per hour for the first 4 hours, and $3 per additional hour, maximum payment of $24, maximum session time is 24 hours" "$0.25 per kWh" "$0.2 per kWh" "$5 per hour" "Level 2: $0.59 per kWh" "Level 2: $0.20 per kWh, maximum payment of $30.00" "Pricing is based on length of time. $1 per hour for the first 4 hours, and $5 per additional hour" "DC Fast: $0.28 per kWh, maximum payment of $30.00" "Level 2: $0.49 per kWh" "Pricing is based on length of time. $1.5 per hour for the first 4 hours, and $5 per additional hour" "Pricing is based on length of time. $1.5 per hour for the first 3 hours, and $5 per additional hour" "$0.49 per kWh, first 5 minutes free, minimum payment of $0.50" "$0.19 per kWh" "$0.2 per kWh, $1 per session" end
0 Response to Cleaning a string variable to create a numerical variable
Post a Comment