I need add string (N/A) to empty cells for a string Variable, I used "subinstr", but lamentably add N/A to other cells with names.
Example:
Code:
clear all
sysuse autornd
*This is only to replicate my real dataset
replace make=" " if make == "AMC Concord"
*add "NA" to car´s name
replace make=subinstr(make," ","N/A",.)
list make in 1/10
+-----------------+
| make |
|-----------------|
1. | N/A |
2. | AMCN/APacer |
3. | AMCN/ASpirit |
4. | BuickN/ACentury |
5. | BuickN/AElectra |
|-----------------|
6. | BuickN/ALeSabre |
7. | BuickN/AOpel |
8. | BuickN/ARegal |
9. | BuickN/ARiviera |
10. | BuickN/ASkylark |
+-----------------+
0 Response to Add string to empty cell
Post a Comment