Hello stata users!
I'm trying to rename all my photos from something like 1295294 to names that contain location and a number. For example, Mexico_photo1.
Here's my code:
forval x = 1/`c(N)' {
local oldname = img_name_[`x']
local newname = new_name_[`x']
di "`oldname'"
di "`newname'"
renfiles, insign("`oldname'") outsign("`newname'") erase
}
The two variables described above are: img_name_, which contains photo numbers like 12345, 13456, 16578, and new_name_, which contains my desired photo names such as Mexico_photo1, UK_photo1. My goal is to assign names to all photos, but the issue is that I also want to assign similar names to certain photo numbers. For example, I want both photo 12345 and photo 18739 to have the name Mexico_photo1. However, my current code is unable to assign the same names to different photos. I would greatly appreciate any suggestions on how to modify my code to achieve this purpose. Thank you in advance for your help.
I'm trying to rename all my photos from something like 1295294 to names that contain location and a number. For example, Mexico_photo1.
Here's my code:
forval x = 1/`c(N)' {
local oldname = img_name_[`x']
local newname = new_name_[`x']
di "`oldname'"
di "`newname'"
renfiles, insign("`oldname'") outsign("`newname'") erase
}
The two variables described above are: img_name_, which contains photo numbers like 12345, 13456, 16578, and new_name_, which contains my desired photo names such as Mexico_photo1, UK_photo1. My goal is to assign names to all photos, but the issue is that I also want to assign similar names to certain photo numbers. For example, I want both photo 12345 and photo 18739 to have the name Mexico_photo1. However, my current code is unable to assign the same names to different photos. I would greatly appreciate any suggestions on how to modify my code to achieve this purpose. Thank you in advance for your help.
Comment