Hi Statalist folks,
I'm having some difficulty deciding how to let a user specify a file location as an option on a user written ado file. Here is the program so far...
When not using the floc() option the output is what I would expect:
When using the floc option as thus I don't get usable output as thus:
Changing the floc to include the last backslash this happens (also not usable):
My hunch is that this has been encountered in the past. But not luck digging it by by searching around. Any hints on how to solve this?
I'm having some difficulty deciding how to let a user specify a file location as an option on a user written ado file. Here is the program so far...
Code:
program mybuddycode syntax varlist(min=2) [if] [in] [, fstub(string) floc(string) replace] // Check if file location (fstub) option provided. If not declare a default. if "`fstub'" == "" { local fstub = "buddy" } // Left commented out during testing. // export delimited `varlist' using "`floc'`fstub'_X.csv" `touse', `replace' di as result "Exported file to: `floc'`fstub'_X.csv, `replace'" end
Code:
. mybuddycode comwant comthink alcdrunk Exported file to: buddy_X.csv,
Code:
. mybuddycode comwant comthink alcdrunk, floc(c:\data) Exported file to: c:\databuddy_X.csv,
Code:
. mybuddycode comwant comthink alcdrunk, floc(c:\data\) Exported file to: c:\data`fstub'_X.csv,
Comment