Hi all,
I'm using Stata 13.1. I have a folder with a large number of PDFs in them. I have a Stata file that contains the names of around 22 PDFs that I want to copy and save in a different directory which will only contain those 22 identified files. I've tried to do this in Stata, but I'm not having any joy, possibly because I'm trying to use 'save' where the PDFs are not a Stata format. Any help appreciated.
This is my sample code:
**Begin code**
local os = "`c(os)' "
display "<`os'>"
if trim("`os'")=="Windows" {
global basedir = "N:\Data"
}
else if trim("`os'")=="MacOSX" {
global basedir = "/Volumes/data/"
}
global PDFs = "${basedir}PDFs"
global WM_PDFs = "${basedir}WM"
cd "$PDFs"
cap nois: mkdir "WM"
import excel "${basedir}Archive\WM_lookup.xlsx", sheet("Sheet1") firstrow clear
keep if WM ==1
g Name = CCG_Code+".pdf"
levelsof Name, local(levels)
foreach l of local levels {
cd "$PDFs"
copy `l'
cd "$WM_PDFs"
save `l', replace
}
**End Code**
I'm using Stata 13.1. I have a folder with a large number of PDFs in them. I have a Stata file that contains the names of around 22 PDFs that I want to copy and save in a different directory which will only contain those 22 identified files. I've tried to do this in Stata, but I'm not having any joy, possibly because I'm trying to use 'save' where the PDFs are not a Stata format. Any help appreciated.
This is my sample code:
**Begin code**
local os = "`c(os)' "
display "<`os'>"
if trim("`os'")=="Windows" {
global basedir = "N:\Data"
}
else if trim("`os'")=="MacOSX" {
global basedir = "/Volumes/data/"
}
global PDFs = "${basedir}PDFs"
global WM_PDFs = "${basedir}WM"
cd "$PDFs"
cap nois: mkdir "WM"
import excel "${basedir}Archive\WM_lookup.xlsx", sheet("Sheet1") firstrow clear
keep if WM ==1
g Name = CCG_Code+".pdf"
levelsof Name, local(levels)
foreach l of local levels {
cd "$PDFs"
copy `l'
cd "$WM_PDFs"
save `l', replace
}
**End Code**
Comment